nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Change permissions of "/dvtcolorconvert.rb" to 755 | sudo chmod 755 /dvtcolorconvert.rb |
Prints long listing of directory $var sorted from oldest to newest, with appended indicators. | $ ls -Fltr $var |
Decompress "path/to/test/file.gz" to standard output and save all lines matching "my regex" and not matching "other regex" to files with a 1000000 line limit | gzip -dc path/to/test/file.gz | grep -P 'my regex' | grep -vP 'other regex' | split -dl1000000 - file |
Extract data from HTML table in "mycode.html" | paste -d: <(grep '<th>' mycode.html | sed -e 's,</*th>,,g') <(grep '<td>' mycode.html | sed -e 's,</*td>,,g') |
Search the .py files residing in the current directory tree for "something" | find . -name "*.py" -type f -exec grep "something" {} \; |
find all the files that are modified in the last 1 day | find -mtime -1 |
Force create a symbolic link as a file named "/usr/lib/jvm/default-java" to "$default_java_dir" with verbose output | sudo ln -sTfv "$default_java_dir" "/usr/lib/jvm/default-java" |
find all files named `linux' on the system | find / -name linux |
Print position number of day '9' in fourth line of calendar output for September, 2009. | cal 09 2009 | awk 'BEGIN{day="9"}; NR==4 {col=index; print col }' |
Represent the UTC date given in time string "1970.01.01-$string1" as number of seconds since the epoch and save it in 't1' variable | t1=$(date -u -d "1970.01.01-$string1" +"%s") |
Print all logins formatted as "The user USER is on TTY" where USER is the user name and TTY is the login terminal | who | awk '{print "The user " $1 " is on " $2}' |
Prints file.txt without the last N bytes | head -c -N file.txt |
search for all the directories in the current folder, do not search in sub folders and run the 'pwd' command in all these directories | find . -maxdepth 1 -type d \ -exec bash -c "cd '{}' && pwd" \; |
Show find's version | find --version |
Find all *.swp files/directories under current directory | find . -name "*.swp" |
Mount image "test" to loop device "/dev/loop0" | sudo mount -o loop /dev/loop0 test |
Find all files/directories named 'query' under current directory | find -name "query" |
Remove all files named "filename" from the current directory tree, ignoring directory "FOLDER1" | find . -name FOLDER1 -prune -o -name filename -delete |
Read a line from standard input with a timeout of 0.1 seconds and prompt "This will be sent to stderr" | read -t 0.1 -p "This will be sent to stderr" |
show a count of the number of filenames ending in .txt in the current directory, without descending into sub-directories | find . -maxdepth 1 -name \*.txt -print0 | grep -cz . |
Remount "/path/to/chroot/jail/usr/bin" as read only | mount -o remount,ro /path/to/chroot/jail/usr/bin |
Set the variable "me" to the name of the running script. | me=`basename "$0"` |
search for a word in all the files in the entire filesystem and display the matched fline along with the file name | find / -type f -exec grep -Hi 'the brown dog' {} + |
Make directory and parents as needed for the directory name of file "$f" | mkdir -p -- "$(dirname -- "$f")" |
Search the "katalogi" directory tree for files named "wzorzec" | find katalogi -name wzorzec |
find all text files in the current folder | find -name "*.txt" |
display all the directories in the folder /var and do not go beyond 2 levels during search | find /var -maxdepth 2 -type d; |
Search the current directory tree for .aux files | find . -name ".aux" |
Remount "/system" with read only permission | mount -o remount,ro /system |
Print common lines in files "set1" and "set2" | comm -12 < < |
Find all files/directories in entire file system that have "write" bit set for either the owner, the group, or others | find / -perm /u+w,g+w,o+w |
Locate all passwd files on the system | find / -name passwd |
Recursively find the latest modified "zip" file in the current directory | find . -name "*zip" -type f | xargs ls -ltr | tail -1 |
Finds all files in a '/path' folder and prints long listing for them. | find /path -type f -exec ls -l \{\} \; |
Find all OGG files in the home directory that are at most 20 megabytes in size | find $HOME -iname '*.ogg' ! -size +20M |
Search in current directory downwards all files whose size is 10 blocks . | find . -size 10 print |
Find all file paths under current directory, perform a reverse numerical sort and show first 10 file paths with their status change time | find . -type f -printf "%C@ %p\n" | sort -rn | head -n 10 |
find all the files in the /usr folder which have modification date less than or equal to the file "/FirstFile" | find /usr ! -newer /FirstFile -print |
Prints Kb size of all top-level files and folders in a current folder in descending order in human readable format. | du -ksh * | sort -n -r |
Print host name followed by ":" and the contents of "/sys/block/sda/size" | echo "$:$" |
Find all *.ps files under $STARTDIR and run ps2pdf for each files with the file path as a argument | find $STARTDIR -name '*.ps' -print | sed -e 's/.ps$//' | xargs -l -i ps2pdf \{}.ps |
Find all regular files that were modified $FTIME days ago under current directory tree | find . -type f -mtime $FTIME |
find all the ".sh" files in the current folder ( case insensitive search) | find -iname *.SH |
find all files in the current folder which have been modified in the last 24 hours and whose file name is of length 1 | find . -name \? -mtime -1 |
find all the core files in the temp folder and force delete them | find /tmp -name core -type f -print | xargs /bin/rm -f |
find all files in the current directory and sub-directories that were accessed after modifying /etc/hosts | find -anewer /etc/hosts |
Write "foo" to the real path of the current command's standard input | echo foo | readlink /proc/self/fd/1 |
create a symbolic link named "-pdf-kundendienst" to "local--pdf-kundendienst" file | ln -s -- ./local--pdf-kundendienst -pdf-kundendienst |
Find all files under current directory that were modified less than 1 day ago | find -mtime -1 |
Remove recursively Emacs backup files in the current directory | find . -name '*~' -print0 | xargs -0 rm |
Search in the current directory and all sub-directories except ./D for the file named hi.dat. | find . \ -o -name hi.dat |
Search the current directory tree for all regular files matching pattern "*.rb" | find . -name "*.rb" -type f |
Request that the master ssh connection "officefirewall" exits | ssh -O exit officefirewall |
Find all *.txt files except for those on other file systems | find / -name "*.txt" -mount 2> /dev/null |
find not case sensitive all directories that names are 'project.images' | find / -type d -iname "project.images" -ls |
Compress all directories found in directory tree $LOGDIR that have been modified within the last 24 hours | find $LOGDIR -type d -mtime -1 -exec compress -r {} \; |
Execute the file utility for each file found under /etc and below | find /etc -print0 | xargs -0 file |
Find regular files in the current directory tree that are called FindCommandExamples.txt and remove them | find . -type f -name "FindCommandExamples.txt" -exec rm -f {} \; |
Search "file1" for lines matching regex patterns listed in "file2" and list the unique results | grep -f file2 file1 | sort -u |
Find all directories with permissions 777 under and below /var/www/html, and change their permissions to 755 | find /var/www/html -type d -perm 777 -print -exec chmod 755 {} \; |
List all unique parent directories of .class files found under the current directory | find -name '*.class' -printf '%h\n' | sort -u |
Find all files/directories under current directory and print their paths | find . -exec echo {} \+ |
Prompt the user with a question "This is the question I want to ask?" and save "y" or "n" in variable "REPLY" in zsh | read REPLY\?"This is the question I want to ask?" |
Compress a file named '{}' in the current directory | gzip "{}" |
Find all .gif files in the /var/www directory tree that are between 5 kB and 10 kB in size | find /var/www -name *.gif -size +5k -size -10k |
Delete all empty files/directories under test directory | find test -depth -empty -delete |
Search the current directory tree for files named 'Subscription.java' | find . -name 'Subscription.java' |
Create a symbolic link named "~/bin/subl" to "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" | ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl |
Write '"myname="Test"' to the console and append to "$CONFIG" as root | echo "myname=\"Test\"" | sudo tee --append $CONFIG |
Replace all the mathes to regex '<script type="text\/javascript" charset="utf-8" src="file.js"><\/script>.*' with '<script type="text\/javascript" charset="utf-8" src="file2.js"><\/script>' in all HTML files under $DIR directory tree modifying the files in-place | find $DIR -type f -name '*.html' -exec sed -i 's/.*<script type="text\/javascript" charset="utf-8" src="file.js"><\/script>.*/<script type="text\/javascript" charset="utf-8" src="file2.js"><\/script>/g' {} \; |
Find '.git' directories in directory tree /home/madhu/release/workspace | find /home/madhu/release/workspace -type d -name '.git' |
Recursively change ownership of "/usr/lib/node_modules/" to the current user | sudo chown -R $ /usr/lib/node_modules/ |
List all files in /home/bozo/projects directory tree that were modified within the last day | find /home/bozo/projects -mtime -1 |
Print number of bytes in $file. | cat $file | wc -c |
Find all *.txt files under the current directory whose names are not "File.txt" | find . -maxdepth 1 -type f -name '*.txt' -not -name File.txt |
Display a long listing of all the regular files under current directory tree that are newer than ‘Apr 18 23:59:59 EDT 2013’ and older than ‘Apr 20 00:00:00 EDT 2013’ by modification time | find . -type f -newermt ‘Apr 18 23:59:59 EDT 2013’ ! -newermt ‘Apr 20 00:00:00 EDT 2013’ -exec ls -l ‘{}’ \; |
Set variable LINE to full process info of process currently taking the most CPU time, squeezing multiple consecutive spaces into one. | LINE=$ |
Search the current directory tree for regular files that can be read by noone | find -type f ! -perm -444 |
find all executable files | find / -executable |
List files in the current directory and below except for GIT files | find . -not -iwholename '*/.git/*' |
Find files/directories that are owned by the user 'syslog' in entire filesystem | find / -user syslog |
simulate a full login of user root | su - |
Find all 1US* files/directories under current directory | find . -name '1US*' |
find all files in current folder which are bigger than 1 MB and move them to another folder | find . -size +1M -exec mv {} files \+ |
display a long list of all the directories which have files ending with ".todo" | find "$STORAGEFOLDER" -name .todo -printf '%h\n' | uniq | xargs ls -l |
Make directory "/path/to/destination" | mkdir /path/to/destination |
find all the normal/regular files in the folder "pathfolder" which are 2 levels deep, excluding all hidden files and display the count | find pathfolder -mindepth 2 -maxdepth 2 -type f -not -path '*/\.*' | wc -l |
Recursively list all files and directories in "coreutils-8.9" with "DIR: " prepending directory names | tree -F coreutils-8.9 | sed -r 's|── /$|── DIR: \1|' |
Find all files/directories that contain the string literal '`$VERSION`' in their names under current directory tree | find . -name '*`$VERSION`*' |
Fix files to default permissions 644 | find . -type f -exec chmod 644 {} \; |
Counts lines in each of *.php files in a current folder and subfolders and prints total count as well. | wc -l **/*.php |
Find all Subscription.java files/directories under current directory and enter into the parent directory of the first one found | cd $(find . -name Subscription.java | xargs dirname) |
Calculate the md5sum of each ".py" file under "/path/to/dir/", sort the output, and calculate the md5sum of that | find /path/to/dir/ -type f -name "*.py" -exec md5sum {} + | awk '{print $1}' | sort | md5sum |
Search for 'mystring' in all *.txt files under current directory | find . -name "*.txt" -exec egrep mystring {} \; |
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 |
Change permissions of all files ending in ".php" under the current directory to 755 and print a '+' for each file | find . -name '*.php' -exec chmod 755 {} \; -exec echo '+' \; |
Replace "-" with "0" in columns 4 and 5 of file "test.in" and format as a table | awk '{gsub(/-/,"0",$4);gsub(/-/,"0",$5)}1' test.in | column -t |
find all files with the first letter “e” or “f” and last one x in /usr/bin directory: | find /usr/bin -name [ef]*x |
Send SIGTERM signal to entire session of processes containing processes whose command match "rsync". | kill $(ps -o pid= -s $(ps -o sess --no-heading --pid $)) |
Find all *.ps files under $STARTDIR | find $STARTDIR -name '*.ps' -print |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.