nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
change the group of all the files in the folder /u/netinst/ to staff
|
find /u/netinst -print | xargs chgrp staff
|
Find all files called "INPUT.txt" in the current directory tree and remove lines starting with # in them, saving backup copies as INPUT.txt.bak
|
find . -type f -name INPUT.txt -print0 | xargs -0 -I {} sed -i.bak '/^#/d' {}
|
Wrap each line in "file.txt" to fit in 76 characters breaking only at spaces and indent the output
|
fold -w 76 -s file.txt | pr -T --indent=4
|
Remove the .jpg files from the current directory whose names match regular expression ".+-[0-9]+x[0-9]+\.jpg"
|
find . -type f -regex ".+-[0-9]+x[0-9]+\.jpg" -exec rm -rf {} \;
|
Finds recursively all files in '/path/' that contain 'pattern', and prints matched strings with string number and file name.
|
grep -rnw '/path/' -e 'pattern'
|
set alias "ff" for command "find . -name $1"
|
alias ff=find . -name $1
|
Find all file which have more the 2 hard link
|
find . -type f -links +2 -exec ls -lrt {} \;
|
Remove trailing whitespaces in TXT files from the current directory tree
|
find . -iname '*.txt' -type f -exec sed -i '' 's/[[:space:]]\{1,\}$//' {} \+
|
Search for file names with "bad" characters in the current directory and delete the files.
|
find . -name '*[+{;"\\=?~()<>&*|$ ]*' -maxdepth 0 -exec rm -f '{}' \;
|
Find all files changed on the 29th of September, 2008, starting from the current directory
|
find . -type f -newerct 2008-09-29 ! -newerct 2008-09-30
|
Print newline, word, and byte counts of each '*.java' file within current directory, and total newline, word, and byte counts
|
find . -name \*.java | tr '\n' '\0' | xargs -0 wc
|
split file "${fspec} into pieces named as "xyzzyNNN" with numeric prefix from 1 to 6
|
split --number=l/6 ${fspec} xyzzy.
|
search for the word LOG in all the files in the folder ~/jsmith
|
find ~jsmith -exec grep LOG '{}' /dev/null \; -print
|
Make a copy of file.txt in all directories in current directory - names may not contain spaces.
|
ls -d */ | xargs -iA cp file.txt A
|
Search for Subscription.java under current directory, and go to directory containing it.
|
cd "$"
|
Resolve symbolic link of file "/foo/bar/baz"
|
readlink -e /foo/bar/baz
|
Read 10 bytes from $0 and print them by replacing the set '\000-\377' with '#'
|
head -c 10 "$0" | tr '\000-\377' '#'
|
Exits from login shell.
|
logout
|
recursively change owner of the directory /usr/local/lib to the current user
|
sudo chown -R `whoami` /usr/local/lib
|
display the names without extensions of all the data files in current folder which have not been changed in the last 60 mins
|
find ./ -name "*.dat" -type f -cmin +60 -exec basename {} \;
|
extract archive stored in $1
|
tar -zxvf $1
|
Remove the .jpg files from the current directory whose names match regular expression ".+-[0-9]+x[0-9]+\.jpg"
|
find . -type f -regex ".+-[0-9]+x[0-9]+\.jpg" | xargs rm
|
display all the regular files in the current folder that are exactly 10KB
|
find . -type f -size 10k
|
Prints long listing of the current directory, sorted from oldest to newest, with appended indicators.
|
$ ls -Fltr
|
find all read me files in a folder
|
find /usr/share/doc -name README
|
Extract 8 bytes as an unsigned integer that is "$o" offset into "$rpm"
|
set `od -j $o -N 8 -t u1 $rpm`
|
Prints a random number between 1 and 10
|
grep -m1 -ao '[0-9]' /dev/urandom | sed s/0/10/ | head -n1
|
rename all the png files to jpg files in the current fodler
|
find . -name "*.png" -print0 | sed 'p;s/\.png/\.jpg/' | xargs -0 -n2 mv
|
Move all files not matching "Tux.png" in "~/Linux/Old" to "~/Linux/New/" using zsh with "EXTENDED_GLOB"
|
mv ~/Linux/Old/^Tux.png ~/Linux/New/
|
Merge each line in "file" into a single comma separated line
|
paste -d, -s file
|
Format space separated fields in "filename" as a table
|
column -t -s' ' filename
|
search for the word "slrn" in all the files in the folder $HOME/html/andrews-corner
|
find $HOME/html/andrews-corner -exec grep -q 'slrn' '{}' \; -print
|
Find and show all files in the current directory tree that are smaller than 500 kB
|
find . -size -500k
|
Create 1000 files each file having a number from 1 to 1000 named "file000" to "file999"
|
seq 1 1000 | split -l 1 -a 3 -d - file
|
Convert *.au files to *.wav files using `sox'
|
find -type f -name '*.au' | awk '{printf "sox %s %s\n",$0,$0".wav" }' | bash
|
Prints $m latest modified files within the $d folder, using $f format for printing timestamp.
|
find "$d" -type f -printf "%T@ :$f %p\n" | sort -nr | cut -d: -f2- | head -n"$m"
|
count amount of jobs running
|
jobs | wc -l
|
Find all files under $d directory that are executable by owner and print only their names
|
find $d -maxdepth 1 -perm -100 -type f | sed 's#.*/##'
|
Print each line that is found only once in "file1" and "file2" combined
|
sort file1 file2 | uniq -u
|
Find every JavaScript file in the wordpress directory tree
|
find wordpress -name '*js'
|
Filnd all files in root directory with 777 permission and change permision 644 with chmod commad .
|
find / -type f -perm 777 -print -exec chmod 644 {} \;
|
Search the first 300 commands in history containing "scp" and ending in "important"
|
history 300 | grep scp | grep important$
|
delete all the empty directories in the current folder
|
find . -type d -empty -exec rmdir {} \;
|
change permissions of all the script files in a directory
|
find /home/john/script -name "*.sh" -type f -exec chmod 644 {} \;
|
force remove all the directories with the name logs in the folder /var/www
|
find /var/www -type d -mtime 0 -name logs -exec sudo rm -fr {} \;
|
Find all files named "file.ext" in the current directory tree and print the path names of the directories they are in
|
find . -name "file.ext" -execdir pwd ';'
|
Find one file or directory in the current directory whose name matches the pattern given as a variable $a
|
find . -maxdepth 1 -name "$a" -print -quit
|
find files in current directory that names are game
|
find . -name game
|
Gets IP address of ${NET_IF} network interface.
|
NET_IP=`ifconfig ${NET_IF} | grep -Eo 'inet ?{3}[0-9]*' | grep -Eo '{3}[0-9]*' | grep -v '127.0.0.1'`
|
Creates 5-letter random file name and saves it in 'rand_str' variable.
|
rand_str="$"
|
Rename all *.txt regular files in the current directory tree to *.abc
|
find . -type f -iname '*.txt' -print0 | xargs -0 rename .txt .abc
|
find the type of all the regular/normal files in the current folder
|
find . -type f | xargs file
|
find all txt files under the current folder except ./misc folder
|
find . -path ./misc -prune -o -name '*.txt' -print
|
Find files/directories named<filetype> under current directory which were accessed less than 5 days ago
|
find -name "<filetype>" -atime -5
|
Continuously write "UUUUUUUUUUUUUUUUU" without newlines to "/dev/to/overwrite"
|
yes 'UUUUUUUUUUUUUUUUU' | tr -d '\n' > /dev/to/overwrite
|
Find all *.py files/directories under dir directory ignoring .git path
|
find dir -not -path '.git' -iname '*.py'
|
Find strings with 'Features' in /var/run/dmesg.boot' file
|
cat /var/run/dmesg.boot | grep Features
|
Make directories to "$TARGET_PATH" as needed without causing an error if it exists
|
mkdir -p "$TARGET_PATH"
|
Compress .log files in /var and below on an individual basis
|
find /var -iname \*.log -exec bzip {} \;
|
create a symbolic link named "test" to file ".bashrc"
|
ln -s .bashrc test
|
Return all of the .conf files in Pat's user folder and subdirectories
|
find /home/pat -iname "*.conf"
|
Print full path of command "python"
|
which python
|
find all CSS files that do something with your HTML ID #content
|
find . -name "*.css" -exec grep -l "#content" {} \;
|
Format file "list-of-entries.txt" with no column delimiter
|
column -t -s '' list-of-entries.txt
|
Print lines containing string TEXT from all log files in the current directory.
|
grep -e TEXT *.log | cut -d':' --complement -s -f1
|
search for files which are writable by both their owner and their group
|
find . -perm -220
|
Filters out all comments from the output of the command "crontab -u $user -l" ignoring errors
|
crontab -u $user -l 2>/dev/null | grep -v '^#'
|
display a list of all regular/normal files in the current folder
|
find . -type f -ls
|
search for the regular/normal file "myfile" in the current folder excluding search in the paths of "work" and "home" sub directories
|
find . \ -prune -o -name myfile -type f -print
|
Print your/dir if it's empty
|
find your/dir -prune -empty
|
Replaces any occurences of '*favicon.ico*' in any subfolder with file '/root/favicon.ico'.
|
find . | grep favicon\.ico | xargs -n 1 cp -f /root/favicon.ico
|
display all pdf files in the current folder
|
find . -name *.pdf
|
Filter contents of 'file' through awk commands written in script.awk, display the result.
|
awk -f script.awk file
|
Find files that are 100k
|
find -size 100k
|
Find all empty files in the current directory and delete them
|
find . -type f -maxdepth 1 -empty -print0 | xargs -0 /bin/rm
|
replace the word foo to bar in the current folder in all the regular/normal files containing the word "baz" in their name (does not update the file)
|
find . -type f -name "*baz*" -exec sed -i 's/foo/bar/g' {} +
|
Find all files owned by group `group2'
|
find / -group group2
|
Prefix all files and folders in the current directory with "PRE_"
|
ls | xargs -I {} mv {} PRE_{}
|
List all files/directories under current directory
|
find . -print
|
Silently read standard input until the escape key is pressed ignoring backslash escapes and using the prompt $'Press escape to continue...\n'
|
read -rsp $'Press escape to continue...\n' -d $'\e'
|
display all directories in the folder "$ORIG_DIR"
|
find "$ORIG_DIR" -name "*" -type d
|
Force create a symbolic link without dereferencing named "mylink" to "dir2"
|
ln -nsf dir2 mylink
|
Lists file descriptors of a current process.
|
ls -l /proc/self/fd/
|
search for a word in all the php files in the current folder and display the count of all matching lines.
|
find . -name \*.php -type f -print0 | xargs -0 -n1 grep -Hn '$test' | wc -l
|
Print a count of each unique line from standard input
|
sort | uniq -c
|
Report total file systems disk usage estimated in terabytes
|
df --total -BT | tail -n 1
|
Displays status of currently active network interfaces.
|
ifconfig
|
Search all files in the current directory tree for "SearchString", ignoring .html files and skipping .svn directories
|
find . \ | xargs -d '\n' grep -Hd skip 'SearchString'
|
list all regular files which path is not dir1 or dir2
|
find ! -path "dir1" ! -path "dir2" -type f
|
Generate UUIDs for the files from the current directory tree
|
find . -exec printf '%s\t' {} \; -exec uuidgen \; | awk -F '\t' '{ sub; print $2, $1 }' | sort -k2
|
change the owner of the files which belong to the group 1000 to username and modify only the symbolic link not the originally pointed file
|
find -gid 1000 -exec chown -h :username {} \;
|
Find all hidden files under /tmp
|
find /tmp -type f -name ".*"
|
Remove all *.tmp files from the /tmp directory tree
|
find /tmp -name "*.tmp" -print0 | xargs -0 rm
|
find all the files in the current folder which have the word cache in them and do not search in the sub directories of the folder.
|
find . -name 'cache*' -depth -exec rm {} \;
|
create archive "backup.tar.gz" from /path/to/catalog
|
tar czfP backup.tar.gz /path/to/catalog
|
find all the files in the home folder which have been modified after a file
|
find $HOME -newer ~joeuser/lastbatch.txt
|
Print common lines in "file1" and "file2"
|
comm -12 file1 file2
|
Search the *.pdf files from directory tree PDFs/ for text "perry sound", ignoring the case
|
find PDFs/ -name '*.pdf' -exec sh -c 'pdftotext "{}" - | grep -i --with-filename --label="{}" --color "perry sound"' \;
|
Execute "cat /tmp/iostat.running" every 10 seconds
|
watch -n10 cat /tmp/iostat.running
|
Create a symbolic link in the current directory for each file under the directories matching "../[12][0-9][0-9]"
|
find ../[12][0-9][0-9][0-9] -type f -exec ln -s {} \;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.