nl_command
stringlengths
14
387
bash_code
stringlengths
0
532
run command "${OBJECTDB_HOME}/bin/objectdb.sh start" $JAVA_USER" as user $JAVA_USER
su --session-command="${OBJECTDB_HOME}/bin/objectdb.sh start" $JAVA_USER
find for a word in all the regular files in the current directory
find . -type f -exec grep -li '/bin/ksh' {} \;
Move all files and directories in the current directory to "/foo"
mv `ls` /foo
Search the current directory recursively for regular files last accessed less than 2 minutes ago
find . type -f -amin -2
Find all 755 permission regular files under current directory tree
find . -type f -perm 755
Find all files in the current directory tree and count them
find | wc -l
Tmux configuration to enable mouse support within tmux
set -g mouse on
Search /etc for files modified within the last 10 minutes
find /etc -type f -mmin -10
Decompress and extract 'libxml2-sources-2.7.7.tar.gz'
gzip -dc libxml2-sources-2.7.7.tar.gz | tar xvf -
Find files named 'core' in or below the directory /tmp and delete them
find /tmp -depth -name core -type f -delete
Find all *.dbf files/directories in entire file system
find / -name "*.dbf"
Find regular files named "expression -and expression" under and below /dir/to/search/
find /dir/to/search/ -type f -name 'expression -and expression' -print
Find directories in the current directory tree whose names are 33 characters in length
find . -type d -name "?????????????????????????????????"
Finds strings with dot-separated sequence of numbers, and prints part of that sequence between the first and second dot.
echo "$f" | grep -Eo '[0-9]+[.]+[0-9]+[.]?[0-9]?' | cut -d. -f2
Make 3 directories named "$HOME/Labs/lab4a/folder" followed by a 3 width zero padded number from 1 to 3
mkdir $
Print output of "qstat" with full job names and format as a table
qstat -xml | tr '\n' ' ' | sed 's#<job_list[^>]*>#\n#g' \ | sed 's#<[^>]*>##g' | grep " " | column -t
Print list of bash command aliases.
alias -p | cut -d= -f1 | cut -d' ' -f2
Find files named core in or below the directory /tmp and delete them. Note that this will work incorrectly if there are any filenames containing newlines, single or double quotes, or spaces.
find /tmp -name core -type f -print | xargs /bin/rm -f
Delete all files with ' .o' extension in the entire filesystem
find project / src / -name "* .o" -exec rm -f {} \;
Find all read-only files
find / -perm /u=r
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'
find all the files in the file system which have been accessed in the last 1 day
find / -atime -1
Calculate the md5 sum of all files in "/your/dir" including content and filenames and following symbolic links
grep -aR -e . /your/dir | md5sum | cut -c-32
find all the java script files in a folder and give them as input to a jar
find ./js/ -type f -name "*.js" -exec java -jar compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --js '{}' --js_output_file '{}'.compiled \;
display all the files in the folder /etc /srv excluding those that are present in the path of ./srv/tftp/pxelinux.cfg* and /etc/mtab
find /etc /srv \! -path "./srv/tftp/pxelinux.cfg*" -a \! -name /etc/mtab
display long list of all the files in the folder /home/peter which belong to no user and change the owner,group of all these files to "peter","peter"
find /home/peter -nouser -exec ls -l {} \; -ok chown peter.peter {} \;
display all the files in the current folder in a single line separated by null command
sudo find . -print0
Make a new directory "new-dir" in every directory in the current directory tree
find . -type d | xargs -I "{x}" mkdir "{x}"/new-dir
Change to directory 'foo' and print to terminal all received on standard input
cd foo | cat
find files which do not have all permissions to all the users in the current directory
find . -type f ! -perm 777 | head
Find all *.jpg files/directories under current directory
find . -name '*.jpg'
Find all *.gz files under asia and emea directory and print their names and line counts to file_count.txt
for file in $; do echo -n $; gunzip -c $file |wc -l; done >> file_count.txt
Find all files/directories under $TARGET_DIR directory tree matching the posix extended regular expression \".*/$now.*\" and save the output in file $FILE_LIST
find $TARGET_DIR -regextype posix-extended -regex \".*/$now.*\" -fprint $FILE_LIST
search for perl files in the folder /users/tom
find /users/tom -name "*.pl"
Search the current directory tree for all .java files newer than the file build.xml
find . -name '*.java' -newer build.xml -print
Request IP address of 'myip.opendns.com' from name server 'resolver1.opendns.com'
dig +short myip.opendns.com @resolver1.opendns.com
Find all regular files that reside in the current directory tree and were last modified more than 4 days ago
find . -type f -mtime +4
Update 'openssl' package to '2013.09' version.
sudo yum --releasever=2013.09 update openssl
Find all *shp* directories under current directory and move all regular files inside those directories to ../shp_all/
mv $(find $ -type f) ../shp_all/
Recursively changes group ownership of everything within a current directory to 'repogroup'.
chgrp -R repogroup .
find all javascript files under the current folder
find . -name '*.js'
Find all files/directories named $something under current directory
find -name "$something"
Resolve symbolic link of file "FILE" even if the file does not exist
readlink -m FILE
Find files owned by nonexistent groups
find / -nogroup -print
Add read and execute permission to every directory under the current directory
find . -type d -exec chmod +rx {} \;
Display all files in the folder home which are owned by the group test.
find /home -group test
Count the number of equal lines in sorted files "ignore.txt" and "input.txt"
comm -12 ignore.txt input.txt | wc -l
Remove all regular files with extensions php, css, ini, txt from directory tree /old/WordPress/
find /old/WordPress/ -type f -regex ".*\.\" -exec rm {} \;
print lines from last match of ^Statistics until end of file
tac INPUTFILE | sed '/^Statistics |/q' | tac
Print "huge-file.log" starting at line 1000001
tail -n +1000001 huge-file.log
Recursively removes all files in a 'path' folder but 'EXPR' files.
find [path] -type f -not -name 'EXPR' | xargs rm
Archive "/path/to/copy" on host "remote" as user "user" to "/local/path" via ssh on port "$portNumber"
rsync -avz -e "ssh -p $portNumber" [email protected]:/path/to/copy /local/path
Remove all "core" files that were last changed more than 4 days ago from the current directory tree
find . -name core -ctime +4 -exec /bin/rm -f {} \;
find all files in the file system which belong to the user pat and having the word "filename" in their name.
find / -user pat -iname "filename"
Print unique lines of "a" and "b"
comm -3 a b
Print 1000 astarisk
head -c 1000 /dev/zero | tr '\0' '*'
switch to user username
su username
Set up SSH connection forwarding in the background with no terminal or command execution from localhost port 8888 to "proxyhost" port 8888 and a reverse connection from "officefirewall" port 22222 to "localhost" port 22
ssh -fNT -L8888:proxyhost:8888 -R22222:localhost:22 officefirewall
searching for all files with the extension mp3
find / -name *.mp3
Recursively finds and compresses all files in a current folder with 4 parallel processes.
find . -type f -print0 | xargs -0 -n1 -P4 bzip2
Print a line of 100 random characters either "." or " "
cat /dev/urandom | tr -dc '. ' | fold -w 100 | head -1
Find all files/directories named 'my.txt' in the entire filesystem
find / -name "my.txt"
Find regular files in the current directory tree that have all executable bits set
find -L . -type f -perm -a=x
Find directories in the current directory tree that were modified within the last 24 hours and move them to /path/to/target-dir
find . -type d -mtime -0 -print0 | xargs -0 mv -t /path/to/target-dir
Sort ":" delimited lines in "test.txt" by the first and third field preserving only unique lines
sort -u -t : -k 1,1 -k 3,3 test.txt
Show version information of the find utility
find -version
Prints long recursive listing of all content of a root folder, appending output to 'output.file'.
ls -lR / | tee -a output.file
find all the files ending with ".mkv" in a folder and send them as an argument to a shell script
find /volume1/uploads -name "*.mkv" -exec /tmp/rename.sh \{\} \;
list all files under the current directory, writing the output to the file files_and_folders, suppressing all error messages.
find . 2>/dev/null > files_and_folders
Forcibly removes all files like '*.bak' and '*~'
rm -f *.bak *~
find case-insensitive StringBuffer in all *.java files
find . -type f -name "*.java" -exec grep -il string {} \;
Replace all occurrences of 'previousword' with 'newword' in all regular files with '.cpp' extension under '/myprojects' directory tree and modify them in-place
find /myprojects -type f -name *.cpp -print0 | xargs -0 sed -i 's/previousword/newword/g'
Print a line of 3 '%' characters
seq -s % 4|tr -d '[:digit:]'
Find all directories under /home/username/public_html/themes and set their permission to 750
find /home/username/public_html/themes -type d -exec chmod 750 {} +
Count the number of differing lines in "file1" and "file2"
diff file1 file2 | grep ^[\>\<] | wc -l
Find all *text files/directories under current directory
find -name "*text"
Create a symbolic link named "$HOME/bin/" to "$HOME/downloads/fnord"
ln -s $HOME/downloads/fnord $HOME/bin/
Create a symbolic link named "$SYMLINK" to "$ACTUAL_DIR"
ln -s "$ACTUAL_DIR" "$SYMLINK"
Find all *.jpg files in Cam2/2013* paths and send the contents to a ffmpeg command to create a video file
find Cam2/2013* -name "*.jpg" -print0 | xargs -0 cat | ffmpeg -f image2pipe -framerate 30 -vcodec mjpeg -i - -vcodec libx264 -profile:v baseline -level 3.0 -movflags +faststart -crf 19 -pix_fmt yuv420p -r 30 "Cam2-2013-30fps-19crf.mp4"
Find all files/directories which have been modified from the start of the day in directories/files taken from the glob pattern '/tmp/test/*'
find /tmp/test/* -daystart -mtime -0
Find and remove multiple files such as *.mp3 or *.txt under current directory
find . -type f -name "*.txt" -exec rm -f {} \;
Find the most recently changed files in a subtree
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort
Copies all files like '*.txt' under the current directory to the './tmp/' directory.
find . -type f -name '*.txt' | sed 's/'"'"'/\'"'"'/g' | sed 's/.*/"&"/' | xargs -I{} cp -v {} ./tmp/
count the total number of lines that are present in all the normal/regular files
find . -type f -exec wc -l {} \; | awk '{total += $1} END{print total}'
Format tab delimited file "list-of-entries.txt" as a table
column -t -s $'\t' list-of-entries.txt
Replace the spaces after line number in the output of history with ".."
history | sed 's/^\ */\1../'
Display the contents of 'your_file' wrapping lines to maximum 80 characters, and waiting for user interaction after each page.
fold -80 your_file | more
find all files that names are dir-name-here
find / -name "dir-name-here"
Print each logged in user's full name
finger | awk 'NR>1{print $2,$3}'
Get domain "$domain" IP address
dig +short "$domain"
Find directories owned by user news with permissions 775
find / -user news -type d -perm 775 -print
Recursively copy "emptydir" to "destination/newdir"
rsync --recursive emptydir/ destination/newdir
display all regular files in current folder excluding search in the directories that are ending with "git,svn"
find . \( -type d -regex '^.*/\.\$' -prune -false \) -o -type f -print0
Delete all .svn subdirectories under current directory
rm -rf `find . -type d -name ".svn"`
Find out all files owned by user vivek
find / -user vivek
display all the regular/normal files in the folder "/home/user/demo" which have the permission 777.
find /home/user/demo -type f -perm 777 -print
Removes everything from current folder but '*ddl*' and '*docs*' files.
ls -1|grep -v -e ddl -e docs| xargs rm -rf
Remove recursively Emacs backup files in the current directory
find . -name '*~' -print0 | xargs -0 rm
Extract protocol part from URL.
echo "$url" | cut -d':' -f1
Recursively finds files like '*.php' or '*.phtml' in folder /project/directory ignoring case differences, filters out files with any cased pattern '/some/directory' in path, and processes found files with xgettext tool.
find /project/directory -iname '*.php' -or -iname '*.phtml' | grep -iv '/some/directory' | xargs xgettext