nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
find all the configuration files in the file system | find / -name "*.conf" |
find all the files that are not modified in the last 7 days | find -daystart -mtime +7 |
Gets IP addresses of all active network interfaces on host. | ifconfig | grep 'inet' | grep -v '127.0.0.1' | awk '{print $2}' | sed 's/addr://' |
Search in current directory downwards all files which have not been accessed since last 7 days | find . -atime +7 -print |
Remove all characters except ";" and digits from standard input | tr -cd ";0-9" |
find all the directories in the file system which have read, write and execute to all the users | find / \ -print |
display all the regular/normal files in current directory | find . -type f |
Extract any line in sorted file "A" that does not appear in "B", "C", or "D" | cat B C D | sort | comm -2 -3 A - |
find the md5 sum of all the regular files in multiple folders and display them in sorted order | find teste1 teste2 -type f -exec md5 -r {} \; | sort |
prints a line 19 lines from the line containing PATTERN | tac | sed -n '/PATTERN/,+19{h;d};x;/^$/!{p;s/.*//};x' | tac |
find all read me files in a folder | find /usr/share/doc -name README |
Delete all .svn files/directories under current directory | find . -depth -name .svn -exec rm -fr {} \; |
Recursively copy directory or file /something on host "myServer" to current directory on local host, connecting as ssh user matching username on local host. | scp -r myServer:/something |
Finds files in 'directory' folder with the same name and location but different content than files in 'directory.original' folder and prints location of such files. | diff -qr directory directory.original | cut -d' ' -f2 | xargs dirname | uniq |
find all the files in the current folder which have been modified for the ffiles that are at least one week old (7 days) but less then 30 days old | find . -mtime +30 -a -mtime -7 -print0 |
Print which files differ in "/tmp/dir1" and "/tmp/dir2" recursively | diff -qr /tmp/dir1/ /tmp/dir2/ |
Unsets shell variable 'penultimate' | unset -v penultimate |
Remove all vmware-*.log files under current directory | find . -name "vmware-*.log" -exec rm '{}' \; |
Make DNS lookup for hostname stackoverflow.com | dig stackoverflow.com |
Find regular files that are bigger than 500 MB in size under current directoryt tree | find . -type f -size +500M |
Archive "/path/to/sfolder/" to "[email protected]:/path/to/remote/dfolder" preserving hard links and compressing the data during transmission | rsync -aHvz /path/to/sfolder/ [email protected]:/path/to/remote/dfolder |
Report file system containing path to /some/dir disk usage in kilobytes. | df -k /some/dir |
Find all the files whose name is FindCommandExamples.txt and contains both capital and small letters in / directory | find / -iname findcommandexamples.txt |
Find file size in bytes | du -b FILE |
Search /etc for files modified within the last day | find /etc -type f -ctime -1 |
Print the time to ping "8.8.8.8" followed by a time stamp if the ping is greater than 50 | ping 8.8.8.8 | awk -F"[= ]" '{if {cmd="date"; cmd | getline dt; close ; print $10, dt}}' |
find files in home directory which are modified yesterday | find ~/ -daystart -type f -mtime 1 |
Find all regular files in the current directory tree that have been modified within the last 10 minutes | find . –type f -mmin -10 |
Run your_command_here with all the files under /target/path as arguments | find /target/path -type f -print0 | xargs -0 your_command_here |
prints the last non-empty line of a file | tac FILE |egrep -m 1 . |
Find all directories under ~/code excluding hidden directories and their subdirectories and replace all newlines with : in the output then remove the last : | find ~/code -type d | sed '/\/\\./d' | tr '\n' ':' | sed 's/:$//' |
List the unique tab delimited field number "$FIELD" in all files, prefix with the number of occurrences, sort from most frequent to least frequent | cut -f $FIELD * | sort| uniq -c |sort -nr |
Search the current directory tree for files and directories whose names begin with "pro" | find . -name pro\* |
Remove all *.log files from the current directory tree that have been gzipped | find ./ -name '*.log' | xargs -I{} sh -c "if [ -f {}.gz ]; then rm {}; fi" |
Compress all files in the "$FILE" directory tree that were last modified 30 days ago | find $FILE -type f -mtime 30 -exec gzip {} \; |
Print all files that exceed 1000 blocks and were modified at least a month ago | find / -size +1000 -mtime +30 -exec ls -l {} \; |
For each line in list.txt, output the line adding "FAIL" if the same line appears in fail.txt, and "PASS" otherwise - lines in fail.txt must be in the same order as they appear in list.txt. | sed 's/$/ FAIL/' fail.txt | join -a 1 -e PASS -j 1 -o 1.1,2.2 list.txt - |
Find all symlinks under current directory | find ./ -type l |
print all readline bindings | bind -P |
Find the current directory and all its subdirectories. | find . -type d |
Copy all files with '.png' extension under '/home/mine' directory tree to '/home/mine/pngcoppies/copy.' directory | find /home/mine -iname "*.png" -execdir cp {} /home/mine/pngcoppies/copy{} \; |
display the type of all the regular/normal files in the entire file system | find / -type f -print | xargs file |
Search for the string 'nameserver' in all files under /etc | find /etc -type f -print0 2>/dev/null | xargs -0 grep --color=AUTO -Hn 'nameserver' 2>/dev/null |
Copies file '/boot/config-`uname -r`' to the '.config', printing info message and prompting before owerwriting files. | cp -vi /boot/config-`uname -r` .config |
Find all the *.c files at any level of directory Programming under any 'src' directory | find ~/Programming -path '*/src/*.c' |
list all the drectories present in the current directory and do not search in the sub directories. | find -maxdepth 1 -type d |
Find files which were changed in the past 1 hour | find . -cmin -60 |
Calculate the md5 sum of the list of files in the current directory | find . -maxdepth 1 -type f | md5sum |
Show a long listing of files not modified in over 20 days or not accessed in over 40 days | find /mydir \(-mtime +20 -o -atime +40\) -exec ls -l {} \; |
list all CSS files under the current directory | find . -name "*.css" |
Find all .c and .h files in the current directory tree and search them for "expr" | find -name '*.[ch]' | xargs grep -E 'expr' |
Treat each line of "list-of-entries.txt" as a value to be put in one cell of the table that "column" outputs | column list-of-entries.txt |
beginning at the end of the file, prints lines matching /2012/ and exits after first non-matching line | tac error.log | awk '{ifprint;else exit}' |
Find files named 'fileName.txt' under '/path/to/folder' directory tree ignoring 'ignored_directory' | find /path/to/folder -name fileName.txt -not -path "*/ignored_directory/*" |
find all the directories in the folder /raid with the extension local_sd_customize. | find /raid -type d -name ".local_sd_customize" -print |
Archive directory "." to "server2::sharename/B" | rsync -av . server2::sharename/B |
Display the entire contents of 'file', replacing only the very first instance of "old" with "new". | grep -E -m 1 -n 'old' file | sed 's/:.*$//' - | sed 's/$/s\/old\/new\//' - | sed -f - file |
display all regular/normal files which have been modified in the last 30 minutes | find -type f -and -mmin -30 |
Search for 'sometext' in all the files with '.txt' extension under current directory tree and also print the filenames | find . -name '*.txt' -exec grep 'sometext' '{}' \; -print |
search for all regular files in the current directory which have the extension "c" or "asm" | find . -type f \ |
Gets a current job back to the foreground. | fg |
Find all files in the current directory recursively with "linkin park" in their names and copy them to /Users/tommye/Desktop/LP, preserving path hierarchy | find . -type f -iname "*linkin park*" | cpio -pvdmu /Users/tommye/Desktop/LP |
split all files in directory "posns " into pieces per 10000 lines | find posns -type f -exec split -l 10000 {} \; |
Make directory "temp" | mkdir temp |
Reattach to a screen session | screen -d -r remote-command |
Find all Lemon*.mp3 files under current directory and run mplayer with these files | find . -name 'Lemon*.mp3' -print0 | xargs -0 mplayer |
Search for xception in all *auth*application* files under current directory and count the number of matches | zegrep "xception" `find . -name '*auth*application*'` | wc -l |
Print a tab separated table in "table.txt" with cell borders | sed -e 's/\t/_|/g' table.txt | column -t -s '_' | awk '1;!(NR%1){print "-----------------------------------------------------------------------";}' |
Find the largest files in a particular location | find /home/tecmint/Downloads/ -type f -printf "%s %p\n" | sort -rn | head -n 5 |
find for a word in all the regular files in the current directory | find . -type f -print | xargs grep -li 'bin/ksh' |
display all files in the file system which are bigger than 50MB and having size "filename" in them | find / -size +50M -iname "filename" |
Find all files on local host whose name contains "labra" and copy them to remote host 11.11.11.11 connecting as ssh user "masi" and copying the files to the Desktop directory this user's home directory - this will not work with file/path names containing spaces. | locate labra | xargs -I{} scp '{}' [email protected]:~/Desktop/ |
Unzip file "$empty_variable" | gunzip $empty_variable |
search for all the files in the folder /home/user1 which end with ".bin" | find /home/user1 -name "*.bin" |
Output success.txt omitting lines whose first field appears in fail.txt - lines in fail.txt must appear in the same order as they do in success.txt. | join -v1 success.txt fail.txt |
Mathematically sum all lines in "infile" | sed 's/^/.+/' infile | bc | tail -1 |
create a symbolic link named "/usr/bin/openssl" to file "/usr/local/ssl/bin/openssl" | ln -s "/usr/local/ssl/bin/openssl /usr/bin/openssl |
display a list of all the files in the home folder which have been modified today | find ~ -type f -mtime 0 -ls |
Find all *.c files under and below the current directory that contain "wait_event_interruptible" | find . -name \*.c -print | xargs grep wait_event_interruptible /dev/null |
Search for files whose name is "filename" and whose permissions are 777 | find / -perm 777 -iname "filename" |
Show manual of the find utility | man find |
Find all *.txt files/directories under current directory | find . -name *.txt -print |
Display the host's ECDSA fingerprint using the md5 hasing algorithm. | ssh-keygen -l -E md5 -f /etc/ssh/ssh_host_ecdsa_key.pub |
Make directories in "/TARGET_FOLDER_ROOT/" for each ".mov" file in the current directory tree | find . -type f -iname \*.mov -printf '%h\n' | sort | uniq | xargs -n 1 -d '\n' -I '{}' mkdir -vp "/TARGET_FOLDER_ROOT/{}" |
find files which full path name is /tmp/foo/bar under foo directory and print | find /tmp/foo -path /tmp/foo/bar -print |
search for version in system.info files. | find /home/*/public_html/ -type f -iwholename "*/modules/system/system.info" -exec grep -H "version = \"" {} \; |
Remove all tmp/*.mp3 files | find tmp -maxdepth 1 -name *.mp3 -print0 | xargs -0 rm |
Look for all files whose names match pattern 'my*' | find / -name 'my*' |
Search the current directory tree for files executable by at least someone | find . -type f -perm +111 -print |
Print all files and directories in the `.' directory tree skipping SCCS directories | find . -name SCCS -prune -o -print |
Recursively find strings in all files under current directory, that matching with comma-separated patterns list in file 'searches-txt' | cat searches.txt| xargs -I {} -d, -n 1 grep -r {} |
find all the files ending with .mp3 or .jpg | find . \( -name '*.mp3' -o -name '*.jpg' \) -print |
Print file information of the executable file of command "gcc" | ls `which gcc` -al |
Find all *.sh files owned by user vivek | find / -user vivek -name "*.sh" |
Search the current directory tree for regular files modified within the past 24 hours whose names do not end with ".DS_Store" | find . -mtime -1 ! -name '.DS_Store' -type f -exec basename {} \; |
Display variable 'var' without leading and trailing whitespace. | echo $var | awk '{gsub(/^ +| +$/,"")}1' |
Replace all occurrence of "subdomainA.example.com" with "subdomainB.example.com" in all files under the current directory and below ignoring SVN files | find . \ -type f -print0 | xargs -0 sed -i 's/subdomainA.example.com/subdomainB.example.com/g' |
Run the find command with all positional parameters | find "$@ |
Archive "src" to "dst" without overwriting existing files in "dst" | rsync -a -v --ignore-existing src dst |
display all jpg files in the current folder | find -iname "*.jpg" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.