nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Find all files/directories matching the regex pattern ".*\\.rb$" under current directory
|
find . -regex ".*\\.rb$"
|
Print lines in the sorted contents of "file2" that are not in the sorted contents of "file1"
|
comm -13 < <
|
Decompresses each of "*bz2" files under the current folder, redirecting output to the standard out, and prints only fourth of comma-separated fields.
|
find . -name "*.bz2" -print0 | xargs -I{} -0 bzip2 -dc {} | cut -f, -d4
|
Find all .txt files under the current directory and below
|
find . -name "*.txt"
|
Find all files/directories with 777 permission under current directory tree
|
find . -perm 777 -print
|
Search the current directory tree for *.c and *.asm files, ignoring the case
|
find . -type f \( -iname "*.c" -or -iname "*.asm" \)
|
get the root user access
|
sudo su
|
Create a symbolic lnk named "$1/link" to "$dir"
|
ln -s "$dir" "$1/link"
|
Find all the Sticky Bit files whose permission are 551
|
find / -perm 0551
|
display list of all the files in the current directory
|
find | xargs ls
|
Find all the SGID bit files under current directory whose permissions set to 644 and show a few lines of output from the beginning
|
find . -perm 0644 | head
|
run command "$WEB --quiet" in backgrounf as user named as the value of the variable $USER
|
su $USER -c "$WEB --quiet" &
|
Find all *blue* files/directories under /myfiles
|
find /myfiles -name '*blue*'
|
Find all files/directories under current directory and append a null character at the end of each path
|
find -print0
|
Create a symbolic link named "$1/link" to the existing full and real path of "$2"
|
ln -s "$" "$1/link"
|
Recursively copy all files and directories in current dir except "foo" to location specified by variable "other"
|
rsync --recursive --exclude 'foo' * "$other"
|
Find the files in the current directory that match pattern '*.ISOLATE.quantifier.txt' and move them to folder ISOLATE/
|
find -name '*.ISOLATE.quantifier.txt' -maxdepth 1 -exec mv {} ISOLATE/ +
|
List in detail all *.txt files in the current directory tree, omitting paths ./Movies/*, ./Downloads/*, and ./Music/*
|
find . -type f -name "*.txt" ! -path "./Movies/*" ! -path "./Downloads/*" ! -path "./Music/*" -ls
|
find all the php files in current folder and search for multiple patterns in these files
|
find -name '*.php' -exec grep -li "fincken" {} + | xargs grep -l "TODO"
|
find all empty files
|
find / -empty
|
Find all top-level files in the current folder but ones with name like '*Music*' to the 'dest/' folder.
|
find . -maxdepth 1 -name '*Music*' -prune -o -print0 | xargs -0 -i cp {} dest/
|
Connect to host "${HOSTNAME}" as user "${USERNAME}" and execute "${SCRIPT}" non-interactively
|
ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
|
Delete all regular files named 'FILE-TO-FIND' under current directory tree
|
find . -type f -name "FILE-TO-FIND" -exec rm -f {} \;
|
Merge lines from files "file1", "file2", "file3", "file4", "file5", replace "\t" with " \t", and format the "\t" delimited result as a table
|
paste file{1,2,3,4} | sed -e 's/\t/ \t/g' | column -t -s$'\t'
|
The file "files_to_find.txt" contains a list of filenames, create each file or update its timestamp if it exists.
|
touch `cat files_to_find.txt`
|
force delete all the files that have been modified in the last 3 days
|
find . -mtime -3 -exec rm -rf {} \;
|
searches through the root filesystem for the file named Chapter1, and prints the location
|
find / -name Chapter1 -type f
|
Find all files that are set user ID to root
|
find . -user 0 -perm -4000 -print
|
Search the /usr/bin directory tree for regular files accessed more than 100 days ago
|
find /usr/bin -type f -atime +100
|
display table of files with their name, owner, and size in bytes.
|
find . -printf 'Name: %f Owner: %u %s bytes\n'
|
Find all files named "something" in the current folder and below and run them through the ls -l command in a one batch.
|
find . -name something | xargs -0 ls
|
Sources script incl.sh in the folder where current running script is located
|
source "$/incl.sh"
|
Move "tobecopied/tobeexcluded" to the current directory
|
mv tobecopied/tobeexcluded .
|
Find .jpg files owned by user daniel in the current directory and its sub-directories.
|
find . -user daniel -type f -name *.jpg
|
Find all files/directories with 777 permission under current directory tree
|
find . -perm 777 -print
|
Find files matching pattern $2 in the $1 directory recursively and search them for text $3, where $1, $2, $3 are the command line arguments to the Bash script
|
find $1 -name "$2" -exec grep -Hn "$3" {} \;
|
create and list contents of the archive
|
tar cf - $PWD|tar tvf -
|
Read a single character from standard input into variable "doit" with prompt "Do that? [y,n]"
|
read -n1 -p "Do that? [y,n]" doit
|
Find all files/directories named orm.properties in entire file system
|
sudo find / -name "orm.properties"
|
replace the word foo to bar in the current folder in all the regular/normal files which have execute permission (does not update the file)
|
find . -type f -executable -exec sed -i 's/foo/bar/g' {} +
|
find all the files which end with ".deb" and display their base name
|
find . -name '*.deb' | xargs -n1 basename
|
Removes all files like '*.bak' in a current folder, and prints messages about what is being done.
|
rm -v *.bak
|
list all processes with its PIDs
|
jobs -l
|
Search the current directory tree for files containing "string" in their path names
|
find | egrep string
|
Save absolute path of java home to variable "JAVA_HOME"
|
export JAVA_HOME=$
|
find all the files that were modified two days ago
|
find . -daystart -ctime 1 -type f
|
rename all the text files in the current folder to html files
|
find -name "*.txt" -exec mv {} `basename {} .htm`.html \;
|
List all files/directories under current directory matching the posix-egrep type regex ".+\.(c|cpp|h)$" in their names
|
find . -regextype posix-egrep -regex ".+\.(c|cpp|h)$" -print0 | xargs -0 -n 1 ls
|
Print content of /etc/passwd and /etc/group files
|
cat /etc/passwd /etc/group
|
Find files under '/travelphotos' directory tree which are bigger than 200KB and do not have 2015 in their names
|
find /travelphotos -type f -size +200k -not -iname "*2015*"
|
Execute "tail file | grep pattern" every 2 seconds
|
watch "tail file | grep pattern"
|
Search the current directory tree for *bash* files printing them on a single line
|
find . -name "*bash*" | xargs
|
Format the date represented by time string @1267619929 according to default format and print it
|
date -ud @1267619929
|
List all screen sessions
|
screen -ls
|
Prints first found folder that contains 'ssh' file and has 'bin' in path.
|
dirname `find / -name ssh | grep bin | head -1`
|
Find all directories under /directory-path and change their permission to 2755
|
find /directory-path -type d -exec sudo chmod 2775 {} +
|
Change permissions to 644 for all regular files in and below the current directory
|
find . -type f -print | sed -e 's/^/"/' -e 's/$/"/' | xargs chmod 644
|
display a long listing of all the java files in the current folder in sorted order
|
find . -type f -name '*.java' -ls | sort -k +7 -r
|
Gets all man entries beginning with std and sends them to vi.
|
apropos -r '^std' | vi -
|
Find all test.txt files/directories under current directory
|
find . -name test.txt
|
remove all the ".core" files in the file system
|
find / -name "*.core" -print -exec rm {} \;
|
Archive all files beginning with .env or .bash in current directory to user's home directory on host "app1", preserving timestamps and skipping files that are newer on "app1"
|
rsync -vaut ~/.env* ~/.bash* app1:
|
Unzip all files matching "file_*" and pipe into "agrep -dEOE 'grep'"
|
find . -name "file_*" -follow -type f -print0 | xargs -0 zcat | agrep -dEOE 'grep'
|
Find all empty files under /tmp and below
|
find /tmp -type f -empty
|
display list of all the hidden regular/normal files in the directory "/dir/to/search/"
|
find /dir/to/search/ -type f -iname ".*" -ls
|
Delete all empty directories in the /some/parrent/dir directory tree
|
find /some/parrent/dir -type d | while read d ; do ls "$d"/* &>/dev/null || rm -r "$d"; done
|
List files in directory "one" and "two" that do not exist in the other
|
sort <(ls one) <(ls two) | uniq -u
|
Compresses with compression level 9 all files under the current folder but already compressed '*.bz2' files, performing in background.
|
find "$1" -type f | egrep -v '\.bz2' | xargs bzip2 -9 &
|
display all the header files and cpp files in the current folder
|
find . -regex '.*\.\(cpp\|h\)'
|
Check if "~/mnt/sdc1" is mounted
|
mount | grep -q ~/mnt/sdc1
|
Find files whose name starts with "MyFile", ignoring the case
|
find . -iname 'MyFile*'
|
List files in the current directory
|
find . \( -path './*' -prune \)
|
print top 10 largest files and directories
|
du -a . | sort -nr | head
|
search for files starting with memo and which belong to the user ann in the folder /work
|
find /work -name 'memo*' -user ann -print
|
Print only the line "foo///" given two empty directories foo and bar
|
find foo/// bar/// -name foo -o -name 'bar?*'
|
search normal files called ' banckup ' from /usr directory downward and print them.
|
find /usr -type f -name backup -print
|
Save the full path of command "oracle" to variable "path"
|
path=`which oracle`
|
Add the .abc suffix to the names of all *.txt regular files in the current directory tree
|
find . -type f -iname '*.txt' -print0 | xargs -0 mv {} {}.abc
|
Get current host's IPv6 address.
|
host $ | grep "IPv6 address" | head -n 1 | awk '{print $5}'
|
create a tar of all png & jpg images in the current folder
|
find . \( -iname "*.png" -o -iname "*.jpg" \) -print -exec tar -rf images.tar {} \;
|
create a compressed archive with files newer than 1st of January 2014, 18:00:00.
|
tar -N '2014-02-01 18:00:00' -jcvf archive.tar.bz2 files
|
Count the number of the regular files residing under and below ./randfiles/
|
find ./randfiles/ -type f | wc -l
|
find all the "jpg" file in a folder.
|
find /win/C -iname *JPG
|
Print "*Checking Partition Permission* Hostname=$ LastChecked=" followed by the current date
|
echo -n *Checking Partition Permission* Hostname=$ LastChecked=$
|
Remove the "123_" prefix from all filenames of .txt files in current directory.
|
find -name "123*.txt" -exec rename 's/^123_//' {} ";"
|
find all the directories in the current folder
|
find . -type d -print
|
find all the html files in the current folder which have been modified excatly 7 days before
|
find . -mtime 7 -name "*.html" -print
|
find all the files in the current directory which have been modified after a file
|
find . -newer file
|
Find all *FooBar* files/directories under current directory and copy them to ~/foo/bar
|
find . -name '*FooBar*' -exec cp -t ~/foobar -- {} +
|
List all file paths under the current directory with case insensitive name ".note" in reverse alphabetic order
|
find . -iname '.note' | sort -r
|
Display the number of regular files under current directory tree
|
find . -type f -print0 | tr -dc '\0' | wc -c
|
Create a symbolic link in the current directory for each hidden file or directory in "git-stuff/home/" excluding "." and ".."
|
ln -s git-stuff/home/.[!.]* .
|
display the number of lines in all the files in the current folder
|
find . -name '*' | xargs wc -l
|
Create a symbolic link named "temp" to "newtarget"
|
ln -s newtarget temp
|
Find all files starting from the current directory which are exactly 100MB in size
|
find . -size 100M
|
Find all files whose permission are 777
|
find / -type f -perm 777
|
Print the full path of command "cc"
|
which cc
|
view the manual page of find
|
man find
|
Find all files named "test2" in the current directory
|
find -name test2 -prune
|
Find all files/directories with inode number 16187430 and move them to 'new-test-file-name'
|
find -inum 16187430 -exec mv {} new-test-file-name \
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.