nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Rename file extension '.andnav' to '.tile' for all files/directories under current directory tree
|
find . -name "*.andnav" -exec rename -v 's/\.andnav$/\.tile/i' {} \;
|
Get from file 'File1.txt' strings starting with 'Q', extract only part of them following after '=' sign, and print which ones are not found in 'File2.txt'
|
grep ^Q File1.txt | cut -d= -f2- | sort | comm -23 - <(sort File2.txt)
|
delete all the files in the current folder
|
find . -print0 | xargs -0 rm
|
Extract the contents of rpm "php-5.1.4-1.esp1.x86_64.rpm"
|
rpm2cpio php-5.1.4-1.esp1.x86_64.rpm | cpio -idmv
|
Find all build* directories under /var/www/html/ and reverse sort them
|
find /var/www/html/ -type d -name "build*" | sort -r
|
Write "\n/usr/local/boost_1_54_0/stage/lib" to standard output and append to "/etc/ld.so.conf"
|
echo -e "\n/usr/local/boost_1_54_0/stage/lib" | sudo tee -a /etc/ld.so.conf
|
Remove files in the current directory tree whose names match pattern "file?"
|
find . -name "file?" -exec rm -vf {} \;
|
Display the content of YourFile.txt, waiting for user input at each page.
|
cat YourFile.txt | more
|
Print the contents of "file" with " | " appended to each line
|
echo `sed -e 's/$/\ |\ /g' file`
|
Find all regular files with case insensitive pattern '*$1*' under current directory tree and execute a command given by $2 with each of those files as arguments
|
find . -type f -iname '*'"${1:-}"'*' -exec ${2:-file} {} \;
|
display long listing of all files in the current directory whose size is 24 or 25 bytes (doesnt display inode information) .
|
find . -size -26c -size +23c -exec ls -l '{}' \;
|
Read one character from standard input into variable "REPLY"
|
read -n 1 -r
|
Recursively copy all files and directories matching "*ela*L1*TE*" in localhost's directory /tdggendska10/vig-preview-dmz-prod/docs/sbo/pdf/ to /var/www/html/sbo/2010/teacher/ela/level1 on localhost connecting as ssh user "dalvarado", in batch mode (no prompt for passwords) preserving file permissions and timestamps, and without displaying progress information.
|
scp -Bpqr /tdggendska10/vig-preview-dmz-prod/docs/sbo/pdf/*ela*L1*TE* dalvarado@localhost:/var/www/html/sbo/2010/teacher/ela/level1
|
Print mount point of the file system containing $filename.
|
df "$filename" | awk 'NR==1 {next} {print $6; exit}'
|
Search for all directories named foo, FOO, or any other combination of uppercase and lowercase characters beneath the current directory.
|
find . -iname foo -type d
|
Locating large files in /home/ for 'cleaning'
|
find /home -type f -size +100M -delete
|
Runs programs and prints formatted summary of system resource usage.
|
\time -f "%E real,%U user,%s sys" ls -Fs
|
Shows status of a shell option 'nullglob'.
|
shopt nullglob
|
Compare the contents of gzip-ompressed files "file1" and "file2"
|
diff <(zcat file1.gz) <(zcat file2.gz)
|
delete all the normal files in the current folder and do not delete those in the subfolders
|
find . -maxdepth 1 -type f -delete
|
Add variable TESTVAR with value "bbb" to a temporary environment, and search for TESTVAR in all variables and their values in the resulting environment.
|
TESTVAR=bbb env | fgrep TESTVAR
|
find all js files which path neither ./dir1 nor ./dir2
|
find . -name '*.js' -not \( -path "./dir1" -o -path "./dir2/*" \)
|
Print numbers from 1 to 30 with equalized 0 padding
|
seq -w 30
|
Find files/directories with inode number '212042' under '/var' directory tree without traversing other devices/partitions
|
find -x /var -inum 212042
|
Print history with the first field removed
|
history | awk '{sub; sub; print}'
|
Sort file.txt ignoring the last 10 characters of each line.
|
sort file.txt | rev | uniq -f 10 | rev
|
find all the normal/regular files in the folder "pathfolder" excluding all hidden files and display the count
|
find pathfolder -maxdepth 1 -type f -not -path '*/\.*' | wc -l
|
Find all Makefile's in the current directory tree and print the line 235 of each of them
|
find . -type f -name Makefile -print -exec sed -n '235p' {} \;
|
Prints long listing of content in the current folder with C-style escapes for nongraphic characters
|
ls -lb
|
Delete all files/directories with '.old' extension under current directory tree
|
find . -name “*.old” -delete
|
Synchronize "/path/to/dir_b" with files in "/path/to/dir_a/" if the files are newer
|
rsync -rtuv /path/to/dir_a/* /path/to/dir_b
|
find all text files in the current directory
|
find . -name "*.txt" -print
|
Find all regular files on the system whose size is greater than 20000k
|
find / -type f -size +20000k
|
Find files in the current directory tree whose names begin with "file" and whose size is 0, and remove them
|
find . -name 'file*' -size 0 -print0 | xargs -0 rm
|
Display a long listing of the files/directories with human readable sizes under '/var' directory tree which are bigger than 10MB
|
find /var/ -size +10M -exec ls -lh {} \;
|
display all the files in the current folder for the files which have been accessed in the last 24 hours
|
find . -type f -atime -1
|
Execute "cd /some/directory/myprogram" in the background on target machine "user@target" and write standard output and standard error to foo.out and foo.err
|
ssh user@target "cd /some/directory; nohup myprogram > foo.out 2> foo.err < /dev/null"
|
Find regular files under / that contain "stringtofind" and clear out their contents
|
find / -maxdepth 1 -xdev -type f -exec grep -li "stringtofind" {} + | parallel sed "'/./d'" '{}'
|
Reports time consumed by command 'sleep 1' to the file time.txt together with command error output.
|
{ time sleep 1 ; } 2> time.txt
|
Find all files/directories with '.bar' extension in maximum 2 levels down the current directory
|
find . -name *.bar -maxdepth 2 -print
|
Recursively search for all files with names ending with "_test.rb", renaming them to end with "_spec.rb".
|
find . -name "*_test.rb" | xargs rename s/_test/_spec/
|
Find and remove multiple *.txt files
|
find . -type f -name "*.txt" -exec rm -f {} \;
|
display the contents of all the regular files in the current folder and save the output to out.txt
|
find . -type f -exec cat {} \; > out.txt
|
find a file in current folder and show all errors apart from permission denied
|
find /. -name 'toBeSearched.file' 2>&1 | grep -v 'Permission denied'
|
Find all lines matching "$USER" in "file" and number the output
|
grep $USER file |nl
|
Gets MAC address of eth0 network interface.
|
ifconfig eth0 | grep HWaddr | cut -d ' ' -f 9
|
Invoke a trusted X11 forwarding SSH connection with the server $ssh_server as user $ssh_user
|
ssh -Y $ssh_user@$ssh_server
|
Run two processes, cmd1 whose output is fed as input to cmd2: cmd1 is immune to all SIGHUP signals sent to it, but cmd2 is not.
|
nohup cmd1 | cmd2 &
|
Find all .mp3 files starting from the current directory
|
find . -type f -iname *.mp3
|
find all the directories with the name "c" in the current folder which are at least 3 levels deep and which are not present in the path "/p/".
|
find -mindepth 3 -type d -path '*/p/*' -prune -o -name c -print
|
change the directory to the last found folder in the directory 'a'
|
cd `find a |sed '$!d'`
|
Print all '-' separated digits in file 'infile' as dot ('.') separated digits
|
grep -Eo '([0-9]+-){3}[0-9]+' infile | tr - .
|
find all the files in the home folder that have not been modified in the last one year
|
find $HOME -mtime +365
|
Remove file with inode number 31246
|
find . -inum 31246 -exec rm [] ';'
|
Kill all processes which were executed in background by the current shell.
|
jobs -p | xargs kill -9
|
Find '*prefs copy' files under /mnt/zip and delete them with confirmation prompt ensuring white space safety
|
find /mnt/zip -name "*prefs copy" -print0 | xargs -0 -p /bin/rm
|
Find all PHP files under current directory that contain only one non-blank line
|
find . -type f -name '*.php' -exec grep -Hcm2 '[^[:space:]]' {} + | sed -n '/:1$/{s///;p}'
|
Print last 10 commands in history with the first 7 characters removed
|
history 10 | cut -c 8-
|
split the file "file" into pieces per 2 lines
|
split -n2 infile
|
Find files in the current directory tree whose names match regular expression "^.*~$\|^.*#$"
|
find -regex "^.*~$\|^.*#$"
|
Search the system for files whose names begin with letters 'a', 'b', or 'c'
|
find / -name '[a-c]*'
|
delete all the files in the current folder which are bigger than 1KB
|
find . -size +1024 ?print|xargs -i rm \;
|
Search the directories matching pattern "/path/to/some/dir/*[0-9]" for level 1 subdirectories
|
find /path/to/some/dir/*[0-9] -type d -maxdepth 1
|
Copies files 'src/prog.js' and 'images/icon.jpg' with fully-defined path to '/tmp/package' directory.
|
cp --parents src/prog.js images/icon.jpg /tmp/package
|
Compute the mean average of the word count of *.txt files in the home directory
|
find ~/ -name '*.txt' -print0 | xargs -0 wc -w | awk 'END { print $1/(NR-1) }'
|
Get current directory name without full path, ie. the part after the last /
|
pwd | awk -F / '{print $NF}'
|
Find files in the current directory recursively that are not readable by all
|
find -type f ! -perm -444
|
Recursively change the owner and group of "subdir1" to "user1"
|
chown user1:user1 -R subdir1
|
Copy all files below the current directory whose names contain "FooBar" to directory foo/bar/ in user's home directory.
|
find . | grep FooBar | xargs -I{} cp {} ~/foo/bar
|
check the type of files in the folder /usr/bin
|
find /usr/bin | xargs file
|
Display all regular files under current directory tree ignoring files in './dir1' and './dir2' directories
|
find . -type f |sed '/.\/dir[12]\/[^/]*$/d'
|
Display the contents of /var/log/syslog one page at a time, pausing for user interaction between each.
|
more /var/log/syslog
|
Remove Mac OS X Desktop Services Store files
|
find . -name ".DS_Store" -exec rm {} \;
|
find all the files which end with ".deb" and display their base name (strip the extension)
|
find . -name '*.deb' -exec basename {} \;
|
Change ownership of "/vol" to the current user
|
sudo chown `whoami` /vol
|
Find files newer than `tmpfile' starting from the current directory
|
find . -newer tmpfile
|
create a backup of all normal/regular files in current folder which have been modified between two dates and create a tar.gz file of this backup
|
find /path/to/files/ -newermt 20131204 -not -newermt 20131205 -type f -print0 | cpio --create --null --format=ustar | gzip > /tmp/dec-4.tar.gz
|
Find all *.css files under /starting/directory and print filenames and the lines matching the regex '\.ExampleClass' from those files
|
find /starting/directory -type f -name '*.css' | xargs -ti grep '\.ExampleClass' {}
|
Find files/directories under current directory that matches the regex /path/to/something[^/]*$ in their paths
|
find . | grep -qi /path/to/something[^/]*$
|
Print crontabs of all users in system, skipping messages that some users don`t have crontab.
|
cat /etc/passwd | sed 's/^\:.*$/crontab -u \1 -l 2>\&1/' | sh | grep -v "no crontab for"
|
Write "Hello, world" to standard output and to "/tmp/outfile"
|
echo "Hello, world" | tee /tmp/outfile
|
list all running jobs
|
jobs
|
search for files which are writable by both their owner and their group
|
find . -perm -220
|
move all the files in the current folder to temp folder and search atleast in one subfolder
|
find . -mindepth 1 -exec mv -t /tmp {} +
|
bind word "foobar" to key code "\e[24~"
|
bind '"\e[24~":"foobar"'
|
List ".java" files that have the same contents
|
md5sum *.java | sort | uniq -d -w32
|
find all files under the /etc/sysconfig directory that were accessed in the last 30 minutes
|
find /etc/sysconfig -amin -30
|
Save the current working directory with resolved symbolic links to variable "real1"
|
real1=$(pwd -P)
|
Find files in the current directory tree whose pathnames contain "sub"
|
find ./ | grep "sub"
|
Search for the query "filename" in the current directory and any subdirectories
|
find -iname "filename"
|
Print 1 byte from "/dev/urandom" as a signed decimal value and no address radix
|
od -A n -t d -N 1 /dev/urandom
|
Search the current directory tree for symlinks pointing at other symlinks
|
find . -type l -xtype l
|
Case insensitive search using find command in Linux
|
find . –iname "error" –print find . –iname "error" –print
|
Find all the files/directories in the entire filesystem that do not belong to user 'wnj' and are not newer than the file/directory 'ttt' by modification time
|
find / \! \( -newer ttt -user wnj \) -print
|
Set permissions for files in `foldername' and its subdirectories to 644
|
find foldername -type f -exec chmod 644 {} ";"
|
Find all *.foo files under current directory and print their contents
|
find . -name '*.foo' -exec cat {} \;
|
Display all files in the current directory tree that match "*foo"
|
tree -P "*foo"
|
Print the list of the current directory's subdirectories
|
find -maxdepth 1 -type d
|
Find all directories in current directory without going into sub-directories
|
find . -type d -maxdepth 1
|
Find all directories under current directory whose names are 33 characters long
|
find . -type d -name "?????????????????????????????????"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.