nl stringlengths 13 387 | bash stringlengths 1 532 |
|---|---|
Search only for directories | find -type d |
Search PATH for utilities called "rename", display the type of file (script, executable, ...) for each match found. | which -a rename | xargs file -L |
Search PATH for utilities called "rename", display the type of file (script, executable, ...) for each match found. | which -a rename | xargs readlink -f | xargs file |
Search the path given as the $absolute_dir_path variable for regular files | find "$absolute_dir_path" -type f -print0 |
search the pattern ^PyErr in all the ".c" files in the folder Lib/ | find Lib/ -name '*.c' -print0 | xargs -0 grep ^PyErr |
Search recursively through /mydir, outputting only the base (leaf) name of each file, directory, symlink etc. without any containing directories, that is the part following the last slash. | find /mydir | xargs -I{} basename {} |
Search the regular files from directory tree 'directory_name' for "word" and print the names of the matched files | find directory_name -type f -print0 | xargs -0 grep -li word |
Search the regular files from directory tree 'folder_name' for "your_text" | find folder_name -type f -exec grep your_text {} \; |
Search the regular files of the current directory tree for string "stringYouWannaFind", ignoring the case | find ./ -type f -print -exec grep -n -i "stringYouWannaFind" {} \; |
Search the regular files of the current directory tree for string "stuff" | find . -type f -exec grep -n "stuff" {} \; -print |
Search the regular files of the current directory tree for string "texthere" | find -type f -exec grep -Hn "texthere" {} + |
Search the specified group for the given "filename | find / -group users -iname "filename" |
Search the specified user for the given "filename" | find / -user pat -iname "filename" |
Search the src/ directory recursively for .c and .h files | find src/ -name '*.[ch]' |
Search subdirectory `Linux' in the current directory for file `teste.tex' | find -path './Linux/*' -name teste.tex |
Search the system for *.rpm files ignoring removable media | find / -xdev -name \*.rpm |
Search the system for the file “testfile.txt” | find / -name "testfile.txt" |
Search the system for the file 'myfile' ignoring permission denied errors | find . -name myfile |& grep -v 'Permission denied' |
Search the system for files and directories owned by user `admin' | find / -user admin -print |
Search the system for files named "findcommandexamples.txt", ignoring the case | find / -iname findcommandexamples.txt |
Search the system for files whose names begin with letters 'a', 'b', or 'c' | find / -name '[a-c]*' |
Search the system for regular files whose names are "filename" ignoring the case | find / -type f -iname "filename" |
Search through the /usr directory for all files that begin with the letters Chapter, followed by anything else. | find /usr -name "Chapter*" -type f |
searches through the /usr directory for the regular file named 'Chapter1*' | find /usr -name "Chapter*" -type f |
searches through the /usr/local directory for files that end with the extension .html | find /usr/local -name "*.html" -type f |
Searches through the /usr/local directory for files that end with the extension .html. When these files are found, their permission is changed to mode 644 (rw-r--r--). | find /usr/local -name "*.html" -type f -exec chmod 644 {} \; |
search through only the /usr and /home directories for any file named Chapter1.txt | find /usr /home -name Chapter1.txt -type f |
searches through the root filesystem ("/") for the file named Chapter1. | find / -name Chapter1 -type f |
searches through the root filesystem ("/") for the file named Chapter1. | find / -name Chapter1 -type f -print |
searches through the root filesystem ("/") for the file named Chapter1, and prints the location | find / -name Chapter1 -type f |
searches through the root filesystem ("/") for the file named Chapter1, and prints the location | find / -name Chapter1 -type f -print |
Search user1's home directory tree for *.bin files | find /home/user1 -name \*.bin |
search the word "MySearchStr" in all the regular/normal files in the current folder and display the line number and the file name | find . -type f -print0 | xargs -0 -e grep -nH -e MySearchStr |
Search the xargstest/ directory recursively for files matching pattern 'file??' | find xargstest/ -name 'file??' |
Search the XML files from directories /res/values-en-rUS and /res/xml for string "hovering_msg" | find /res/values-en-rUS /res/xml -iname '*.xml' -print0 | xargs -0 -d '\n' -- grep -i "hovering_msg" -- |
Search the ~ and `Music' directory trees for .mp3 files | find ~ Music -name '*.mp3' |
Search the ~/Books directory recursively for files named "Waldo" | find ~/Books -name Waldo |
Search the ~/Books directory recursively for regular files named "Waldo" | find ~/Books -type f -name Waldo |
See all pages in section 3. | apropos -s 3 . |
See what files are executable by the file's owner and group | find -type f -perm -110 |
See the word count of every *.txt file in the home directory | find ~/ -name '*.txt' -print0 | xargs -0 wc -w |
Select everything selected by * without descending into any directories | find * -maxdepth 0 |
Send two ping requests to "www.google.com" | ping -c 2 www.google.com |
Send 4 ping requests to host "google.comz", displaying only the summary info after the last request completed. | ping -c 4 -q google.comz |
Send 5 ping requests to address 12.34.56.78 and print only the last 2 lines of the summary output. | ping -c 5 -q 12.34.56.78 | tail -n 2 |
Send a single ping request with a TTL of 1 to "192.168.1.1" | ping -c 1 -t 1 192.168.1.1 |
Send an audible ping to "10.100.3.104" | ping -a 10.100.3.104 |
Send at most 3 ping requests to "8.8.8.8" with a timeout of 3 seconds on interface "eth9" | ping 8.8.8.8 -I eth9 -c 3 -w 3 |
Sends current job to the background. | bg |
Sends current job to the background. | bg % |
Send one ping request to host whose name or IP address is specified by variable "ip", using network interface eth9. | ping ${ip} -I eth9 -c 1 |
Send one ping request to host whose name or IP address is specified by variable "remote_machine". | ping -c 1 $remote_machine |
Send one ping request to host with local address in the 10.0.0.x range, with last number specified by variable "i", waiting 1 second for a reply, and output only lines containing "from" to standard output. | ping -W 1 -c 1 10.0.0.$i | grep 'from' & |
Send one ping request to host with local address in the 192.168.1.x range, with last number specified by variable "COUNTER", and output only lines containing "ms" to standard output. | ping -c 1 192.168.1.$COUNTER | grep 'ms' |
Send one ping request to local machine. | ping -c 1 127.0.0.1 #ping your adress once |
Send Output From Find The Find Command To A File | find / -name *.mp3 -fprint nameoffiletoprintto |
Send ping requests to "yourhostname.local" | ping youhostname.local |
Send ping requests to hostname specified by variable "c" for 1 second. | ping -w 1 $c |
Send reverse requests to get domain name for each address in 'my_ips' list | cat my_ips | xargs -i dig -x {} +short |
Send SIGHUP (hangup) signal to nginx master process, causing it to re-read its configuration and restart child processes if necessary. | kill -HUP $( cat /var/run/nginx.pid ) |
Send SIGKILL signal to process ID 16085, killing it instantly. | kill -9 16085 |
Send SIGKILL signal to processes ID 18581, 18582, and 18583, killing them instantly. | kill -9 18581 18582 18583 |
Send SIGTERM signal to first process sent to background by the current shell. | kill %1 |
Send SIGTERM signal to last process sent to background by the current shell. | kill $! |
Send SIGWINCH process to current shell, causing it to update the LINES and COLUMNS variables which describe the size of the screen/window in characters. | kill -s WINCH $$ |
Send TERM signal to process with id listed in '/var/run/DataBaseSynchronizerClient.pid' file | kill `cat /var/run/DataBaseSynchronizerClient.pid` |
Serach for all the files containing grep in man pages | find /usr/share/man/ -regex .*grep* |
Serach for all the files starting with grep in man pages | find /usr/share/man/ -regex grep.* |
Serach in current directory downwards all files which have not been modified since last 7 days | find . -mtime +7 -print |
Serach in root directory all files which have more than 2 links. | find / -links +2 -print |
Sets 'extglob' shell option. | shopt -s extglob |
Sets 'extglob' shell variable. | shopt -s extglob |
Sets 'globstar' shell option. | shopt -s globstar |
Set 444 permission to all regular files under current directory | find . -type f -print | xargs chmod 444 |
Set 644 permission to all regular files under /path | find /path -type f -exec chmod 644 {} +; |
set a crontab to create or update the timestamp of "washere1" in the current directory every minute. | echo "* * * * * touch $(pwd)/washere1" | crontab |
Set the environment variable "DISPLAY" to the system host name followed by ":0 skype" | DISPLAY=`hostname`:0 skype |
Set the environment variable "DISPLAY" to the system host name followed by ":0 skype" | env DISPLAY=`hostname`:0 skype |
Set environment variables using assignments are listed in '.env' file and run 'rails' command with defined environment | env $(cat .env | xargs) rails |
Set the executable bit for all users on all .sh scripts from directory trees lib, etc, debian | find lib etc debian -name "*.sh" -type f | xargs chmod +x |
Set the executable bit for all users on all regular files from directories arch/x86/usr/sbin, arch/x86/usr/X11R6/bin, usr/sbin/ | find arch/x86/usr/sbin arch/x86/usr/X11R6/bin usr/sbin/ -type f | xargs chmod a+x |
Set file permission to 664 and directory permission to 775 for all files and directories under htdocs | find htdocs -type f -exec chmod 664 {} + -o -type d -exec chmod 775 {} + |
Set the group to "username" for all files with GID=1000 in the current directory tree | find -gid 1000 -exec chown -h :username {} \; |
Set the host name to "myServersHostname" | hostname myServersHostname |
Set the host name to the contents of "/etc/hostname" | hostname $(cat /etc/hostname) |
set MyVariable to the value of VARIABLE_NAME | myVariable=$(env | grep VARIABLE_NAME | grep -oe '[^=]*$'); |
Set permissions for all direcotries under /var/www to 755 | find /var/www -type d -print0 | xargs -0 chmod 755 |
Set permissions for all regular files under /var/www to 755 | find /var/www -type f -print0 | xargs -0 chmod 644 |
Set permissions for directories in `foldername' and its subdirectories to 755 | find foldername -type d -exec chmod 755 {} ";" |
Set permissions for files in `foldername' and its subdirectories to 644 | find foldername -type f -exec chmod 644 {} ";" |
Set permissions for files in `foldername' to 777 | find foldername -exec chmod a+rwx {} ";" |
Set permission of "file" to read only for the owner | chmod 600 file |
Set the permissions of all directories inside the current directory tree to ug=rwx,o= | find . -type d -name files -exec chmod ug=rwx,o= '{}' \; |
Set permissions of all directories under "/opt/lampp/htdocs" to 711 | find /opt/lampp/htdocs -type d -exec chmod 711 {} \; |
Set permissions of all directories under "/opt/lampp/htdocs" to 755 | find /opt/lampp/htdocs -type d -exec chmod 755 {} \; |
Set permissions of all directories under "/path/to/base/dir" to 755 | chmod 755 $(find /path/to/base/dir -type d) |
Set permission of all files in "img", "js", and "html" to 644 | chmod 644 img/* js/* html/* |
Set permissions of all files under "/opt/lampp/htdocs" to 644 | find /opt/lampp/htdocs -type f -exec chmod 644 {} \; |
Set permissions of command "node" to 755 | sudo chmod 755 $(which node) |
Set permissions to 2770 for all directories in the current directory tree | find . -type d -exec chmod 2770 {} + |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.