nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Calculate the md5 sum of "logdir" and print only the hash | echo -n "logdir" | md5sum - | awk '{print $1}' |
find all the regular/normal files in the current folder which belong to the user "sedlav" | find . -user sedlav -type f |
Delete all broken symbolic links under '/usr/ports/packages' directory tree | find -L /usr/ports/packages -type l -exec rm -- {} + |
Print each column in "file" with "-" character removed | fold -w1 file | pr -4t | sed 's/\s*-\s*//g' | tr -d '\n' | sed '$a\' |
Saves location of file $1 in 'dir_context' variable. | dir_context=$ |
change the permissions of al the directories in the current folder | sudo find . -type d -exec chmod 755 {} + |
Find all files under current directory and show their file information | find . -type f -exec file {} \; |
Recursively change the owner and group of "/opt/antoniod/" to "antoniod" | chown -R antoniod:antoniod /opt/antoniod/ |
Search for "Stock" in all *.java files from the current directory tree | find . -name "*.java" | xargs grep "Stock" |
Find all *.txt and *.json files in current directory | find . -type f \ |
Join columns in "file1" and "file2" if their first field matches and format the output as a table | join file1 file2 | column -t |
Force create a symbolic link named "id_rsa" to "$keyname" | ln -sf $keyname id_rsa |
search for all the files ending with "fits" in the folder "/store/01" | find /store/01 -name "*.fits" |
Find all files/directories in entire file system more than 700 Megabytes | find / -size +700M |
Make sure the file ".bash_profile" exists in current directory, update its timestamp to current date/time. | touch .bash_profile |
Write output of "ls -lR /" to standard output and to "output.file" | ls -lR / | tee output.file |
Split standard input into files of at most 1000 lines each | split |
Merge 10 already sorted files and display the result, pausing at each page of output. | sort -m a b c d e f g h i j | more |
List all files/directories under current directory and redirect it to /tmp/files.txt | find . -ls > /tmp/files.txt |
Search the specified group for the given "filename | find / -group users -iname "filename" |
Display kernel release name. | uname -r |
Get current directory name without full path, ie. the part after the last / | basename "$" |
Gets IP addresses of all active network interfaces. | ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}' |
List all .c and .h files in the current directory tree that contain "thing" | find . -name '*.[ch]' | xargs grep -l thing |
Search the home directory tree for files modified less than a day ago | find $HOME -mtime -1 |
Print source of the file system containing current working directory. | df . | tail -1 | awk '{print $1}' |
find files in home directory which are modified yesterday | find ~/ -daystart -type f -mtime 1 |
Find all files under current directory | find "`pwd`" -type f |
Executes 'echo "$ret"' in a subshell that is opened by command 'true'. | true | echo "$ret" |
Delete all files with inode number 804180 | find -inum 804180 -exec rm {} \ |
search for all the files in current folder and display all the file names separated by space | find . | paste -sd " " |
list all links from / that point to nothing | find / -type l -print | perl -nle '-e || print'; |
find all the python files in the current folder and save the list to the file output.txt | find . -name "*.py" -type f > output.txt |
Find all directories under htdocs directory and set their permission to 775 | find htdocs -type d -exec chmod 775 {} + |
Print IP addresses of the host name | hostname --ip-address |
Save the date 222 days before today to the variable 'date_222days_before_TodayDay' | date_222days_before_TodayDay=$(date --date="222 days ago" +"%d") |
Replace all ocurrences of '<title>' with 'sblmtitle\n<title>' in all the regular files with '.html' extension under current directory tree | find ./ -type f -name '*.html' | xargs sed -i 's/<title>/sblmtitle\n<title>/g' |
Save small letter short day name of the week to variable 'DayOfWeek' | DayOfWeek=`date +%a |tr A-Z a-z` |
Find all the files in entire file system which are modified more than 50 days back and less than 100 days and show a few lines of output from the beginning | find / -mtime +50 -mtime -100 | head |
Find all files whose names end with "~" in the /home/peter directory tree, following symlinks, and delete them | find -L /home/peter -name *~ |xargs rm |
Find all directories in the current directory tree that are not accessible by all | find -type d ! -perm -111 |
search for all the .o files in the current directory which have permisssions 664 and print them. | find . -name *.o -perm 664 -print |
remove all the core files in the current directory | /bin/find -name "core" — exec rm {} \; |
Find all *.plist files/directories under current directory | find ./ -name "*.plist" |
Find all README's in /usr/share | find /usr/share -name README |
Search in the current directory and all sub-directories except ./D for the file hi.dat using the extending file-globbing features of the shell. | shopt -s extglob find ! -name hi.dat |
delete all the regular files in the temp folder which have not been modified in the last 24 hours | find /tmp/ -type f -mtime +1 -delete |
Change the owner and group of "uid_demo" to "root" | sudo chown root:root uid_demo |
Test if "file.tar.gz" is corrupt | gunzip -t file.tar.gz |
Print specific lines in "File-out" that do not match "File-Reference" to standard output | diff --old-line-format '%L' --new-line-format '' --unchanged-line-format '' < < |
Print a list of all duplicate case insensitive filenames in the current directory tree | find . -type f | awk -F/ '{print $NF}' | sort -f | uniq -i -d |
Remove all files and directories in the /home directory tree whose names are "Trash" | find /home -name Trash -exec rm {} \; |
search for a word in all the files in the current directory | find . -type f -exec grep 'needle' {} \; |
Unsets shell option 'extglob'. | shopt -u extglob |
Find recursively all files under current directory tree that contain a colon in the filename | find . -name \*\:\* |
Remove all libEGL* files from the current directory tree | find . -name libEGL* | xargs rm -f |
Find all *.ogg files/directories under your home directory | find $HOME -iname '*.ogg' |
Search for line 111 in file "active_record.rb" with 2 lines of context | nl -ba -nln active_record.rb | grep -C 2 '^111 ' |
Search subdirectory `Linux' in the current directory for file `teste.tex' | find -path './Linux/*' -name teste.tex |
Show all running processes with a name matching "postgres" | ps -ef | grep postgres |
display all the normal/regular files in the directory FOLDER1 | find FOLDER1 -type f -print0 |
search for a shell script in the current folder and display the current folder path | find . -name onlyme.sh -exec pwd \; |
Compress the file 'file' with 'bzip2' and append all output to the file 'logfile' and stdout | bzip2 file | tee -a logfile |
Prints top-ten of most used utilities from history. | history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -nr | head |
Copies file 'file1' to each of directories 'dir1', 'dir2', 'dir3'. | echo dir1 dir2 dir3 | xargs -n 1 cp file1 |
Search the /media/shared directory recursively for MP3 and OGG files | find /media/shared \ |
find all directories in the current directory which have the name foo and do not have the extension "bar" | find . -name '*foo*' ! -name '*.bar' -type d -print |
Search for 'string' case insensitively in all files under current directory tree and show the matched lines with their filenames | find . -name * | xargs grep -iH "string" |
Find all flies under current directory excluding *.png files and print the file paths (with match count) that match the case insensitive regex 'foo=' in their contents | find . -not -name '*.png' -o -type f -print | xargs grep -icl "foo=" |
Find all directories under present working directory | find $PWD -type d |
search for all perl files in the folder /nas/projects/mgmt/scripts/perl which have been modified yesterday | find /nas/projects/mgmt/scripts/perl -mtime 1 -daystart -iname "*.pl" |
Set permissions to ug=rwx,o= for directories inside the ./default/files tree | find ./default/files -type d -exec chmod ug=rwx,o= '{}' \; |
Create a hard link named "my-hard-link" to "myfile.txt" | ln myfile.txt my-hard-link |
Find all files/directories starting with 'app-' and ending with '.log' in their names and have been modified in the last 5 minutes | find /var/log/crashes -name app-\*\.log -mmin -5 |
Lists all files in a '/home/dreftymac/' folder and subfolders without recursion. | ls /home/dreftymac/* |
Find all *shp* files/directories under current directory | find . -name '*shp*' |
Take a file path from standard input and remove it. | xargs -i rm '{}' |
Create a symbolic link to "$file" named "/tmp/allfiles" | ln $file /tmp/allfiles |
Find files in the current directory tree whose size is less than 24000 bytes | find . -size -24000c |
search for all the files ending with ".bak" in current folder which have not been accessed in the last 30 days and delete the file it it exists | find . -name '*.bak' -type f -atime +30 -exec csh -c 'test -s $1:r && rm $1' '{}' ; |
Find all *.mp4 files under /working | find /working -type f -name '*.mp4' |
Delete all empty directories under test directory | find test -depth -type d -empty -delete |
find all the normal/regular files in /etc/sysconfig which have been accesses in the last 30 minutes | find /etc/sysconfig -amin -30 -type f |
Make directories "bravo_dir" and "alpha_dir" | mkdir bravo_dir alpha_dir |
Count the number of directories in the current directory and below | find . -type f -exec basename {} \; | wc -l |
find all the files that have been modified exactly yesterday (from 00:00 to 23:59 yesterday) | find . -type f -daystart -mtime 1 |
Split the output of "ls" into files of at most 500 lines each with prefix "outputXYZ." | ls | split -l 500 - outputXYZ. |
Mount remote "cifs" filesystem "//server/source/" on "/mnt/source-tmp" with username "Username" and password "password" | mount -t cifs //server/source/ /mnt/source-tmp -o username=Username,password=password |
Report file systems inodes usage. | df -i |
find all files in a directory with default depth size and compress them to lpicpio.2 file | find ~/lpi103-2/ -depth -print0 | cpio --null -o > ../lpicpio.2 |
Continuously print the seconds since Unix epoch and the ping time to "google.com" | ping google.com | awk -F'[ =]' 'NR>1{print system("echo -n $"), $11}' |
Delete the 4th tab separated column from the output of "finger" | finger | awk -F"\t" -v 'OFS=\t' '{ $4=""; print $0}' | sed 's/\t\{2,\}/\t/' |
Print content of all files found regarding seach options '[whatever]' | find [whatever] -exec cat {} + |
find all the ".c" files in the folder "/home/you" which have been accessed in the last 30*24 hours | find /home/you -iname "*.c" -atime -30 -type -f |
Prints processes with 'MDSImporte' in name, cutting off lines longer than screen width, exiting from less after end of output and saving printed lines on terminal after exit. | pstree | grep MDSImporte | less -SEX |
Delete all .svn files/directories under current directory | find . -name .svn |xargs rm -rf |
Find all files that were last modified less than7 days ago under /home | find /home -mtime -7 |
Find all *.$input_file_type files/directories under $source_dir | find "$source_dir" -name *.$input_file_type |
Recursively find files in the current directory with a modification time more than 7 days ago, save the filenames to "compressedP.list", and compress no more than 10 at a time | find . -type f -mtime +7 | tee compressedP.list | xargs -I{} -P10 compress {} & |
Search the current directory and all of its sub-directories for the file 'file1'. | find . -name file1 -print |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.