nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Find all files under /somefolder matching the pattern expanded by $FILE_PATTERN in thier names | find /somefolder -type f -name $FILE_PATTERN |
List all *.png files/directories under /home/kibab directory | find /home/kibab -name '*.png' -exec echo '{}' ';' |
find the count of all the charcters of the list of regular files present in the current folder | find . -type f | xargs | wc -c |
Search the current directory tree for an html file having the text 'Web sites' in it | find . -type f -iname \*.html -exec grep -s "Web sites" {} \; |
List the current directory recursively ignoring the "dir1" subdirectory's content | find . -print -name dir -prune |
Find files/directories not changed in two weeks under /dev/shm | find /dev/shm /tmp -type f -ctime +14 |
display all the files in the home folder which are smaller than 500 bytes | find $HOME -size -500b |
Find all *.* directories under /home/feeds/data directory | find /home/feeds/data -type d \( -name 'def/incoming' -o -name '456/incoming' -o -name arkona \) -prune -o -name '*.*' -print |
exclude vendor and app/cache dir, and search name which suffixed with php | find . -name *.php -or -path "./vendor" -prune -or -path "./app/cache" -prune |
Write output of "ls -lR /" to standard output and append to "output.file" | ls -lR / | tee -a output.file |
Check if "$FILE_PATH" exists on "$HOST" | ssh -q $HOST [[ -f $FILE_PATH ]] && echo "File exists" || echo "File does not exist"; |
Search the current directory tree for regular files that were accessed $FTIME days ago | find . -type f -atime $FTIME |
change the permissions of all the normal files in a directory | find /path/to/dir/ -type f -print0 | xargs -0 chmod 644 |
Look in the current directory and below for all files whose names begin with either "my" or "qu" | find . \( -name "my*" -o -name "qu*" \) -print |
Remove lines matching "kpt#" from "data.txt" and add left-justified line numbers | grep -v 'kpt#' data.txt | nl -nln |
Find all files under /home/username/public_html/sites/default/files and set their permission to 660 | find /home/username/public_html/sites/default/files -type f -exec chmod 660 {} + |
Delete all files under current directory tree with '.$1' extension where $1 expands as the first positional parameter | find . -name "*.$1" -exec rm {} \; |
Find files in the current directory tree that have one link | find . -links 1 |
Prints all child processes of a process with id 20238. | pstree -p 20238 | sed 's/(/\n(/g' | grep '(' | sed 's/(\).*/\1/' |
Remove empty directories from directory tree /srv/abc | find /srv/abc/ -type d -empty -exec rmdir {} \; |
Read yesterday's date with format "%a %d/%m/%Y" into variable "dt" in a subshell | date --date yesterday "+%a %d/%m/%Y" | read dt |
Insert "|" every 30 characters in file "longline" | fold -w30 longline | tr '\n' '|' | sed 's/|$/\n/' |
Print the list of files changed within the last minute | find / -newerct '1 minute ago' -print |
Find and the 5 largest regular files in the Downloads folder of tecmint's home directory and output the file sizes in bytes. | find /home/tecmint/Downloads/ -type f -printf "%s %p\n" | sort -rn | head -n 5 |
convert epoch second timestamp to date | date -d @1278999698 +'%Y-%m-%d %H:%M:%S' |
Show the epoch in default date/time format | date -ud@0 |
Find the current directory and all its subdirectories. | find . -type d |
check if the file pointed by the symbolic exists or not and display those which are broken | find . -type l -! -exec test -e {} \; -print |
Find all files/directories under current directory that match the case insensitive regex .*/\_.* | find . -iregex '.*/\_.*' |
List files larger than 9MB residing in the current directory and below | find . -size +9M |
Set shell option 'histverify'. | shopt -s histverify |
Replace all instances of "STRING_TO_REPLACE" with "STRING_TO_REPLACE_IT" in "index.html" | sed -i 's/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g' index.html |
List files with C-style escape sequences for non-alphanumeric characters | ls -b |
Find x* files/directories under current directory whose status was changed less than 1 day ago and move them to /tmp/other | find . -name "x*" -print0 | strace xargs -0 -I '{}' mv '{}' /tmp/other |
If variable "c" is a syntactically correct cron job, erase user's cron jobs and add "c" as the only cron job for user. | echo $c | crontab |
Forcefully delete all files in the current directory that begin with spam- | find . -name 'spam-*' | xargs rm |
Gets domain name from dig reverse lookup. | dig -x 8.8.8.8 | grep PTR | cut -d ' ' -f 2 | grep google | cut -f 5 |
Convert the contents of "foo.md" to GitHub style markdown and display with "lynx" | cat foo.md | pandoc -f markdown_github | lynx -stdin |
split the file "/path/to/large/file" into pieces per 50000 lines named as /path/to/output/file/prefixNNN | split --lines=50000 /path/to/large/file /path/to/output/file/prefix |
Print local SRV record of domain '_etcd-client._tcp.' | dig @"127.0.0.1" _etcd-client._tcp. SRV |
Find files bigger than 20 megabytes in the home directory tree | find ~ -size +20M |
Print file system disk space usage with a grand total | df --total |
Find all files under current directory excluding hidden files | find . -depth -path './.*' -prune -o -print |
Continuously send ping requests to broadcast address "10.10.0.255" and print the IP addresses who respond | ping -b 10.10.0.255 | grep 'bytes from' | awk '{ print $4 }' |
Replace all newlines from the contents of "file" except the last with spaces | sed ':a;N;$!ba;s/\n/ /g' file |
Create an empty file 'last.check' in directory pointed by variable "log_dir", with specified timestamp. | touch -m 201111301200.00 $log_dir/last.check |
Find recursively all Python files in the current directory and search them for the word ‘import’ | find . -name '*.py' | xargs grep 'import' |
Archive the directory structure under backup directory into directory-structure.tar | find backup/ -type d -print0 | xargs -0 tar cf directory-structure.tar --no-recursion |
List all users logged into the current tty | who | grep "$" |
Remove duplicate lines in "file_name" and print the output on stdout | awk '{print(NR"\t"$0)}' file_name | sort -t$'\t' -k2,2 | uniq -u --skip-fields 1 | sort -k1,1 -t$'\t' | cut -f2 -d$'\t' |
Delete all hidden files/directories under $some_directory | find "$some_directory" -name '.*' ! -name '.' ! -name '..' -delete |
Reverse the text in $input by taking each 4 characters as each units and save the result in variable 'output' | output=$(echo $input | fold -w4 | tac | tr -d \\n) |
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 regular files in $DIR directory tree which have not been modified in the last 15 days and delete them | find "$DIR" -type f -mtime +15 -exec rm {} \; |
Save small letter short day name of the week to variable 'DayOfWeek' | DayOfWeek=`date +%a |tr A-Z a-z` |
Find files/directories under current directory and force xargs to print them one by one | find . | xargs -n 1 echo |
Recursively change the group ownership to "laravel" in "./bootstrap/cache" | sudo chown -R :laravel ./bootstrap/cache |
print all lines after the last match of 'string match' | tac infile | sed '/string match/,$d' | tac |
Save full path of command "cat" to variable "CAT" | CAT=`which cat` |
List all files/directories under /data1/Marcel with their file information which are greater than 524288 bytes and were modified or accessed more than 1 year ago | find /data1/Marcel -size +1024 \( -mtime +365 -o -atime +365 \) -ls -exec file {} \; |
Find all directories in the /data1/realtime directory tree that were last modified more than 5 minutes ago but less than 60 minutes ago | find /data1/realtime -mmin -60 -mmin +5 -type d |
Write "ee" to standard output and "/dev/stderr" as input to "foo" | echo 'ee' | tee /dev/stderr | foo |
find file named foo.txt under root / directory. | find / -name foo.txt |
Print the IP addresses for the current host name | hostname -I |
Copy files printed by "any_command_what_produces_relative_path_names" to "/new/parent/dir" preserving the directory hierarchy | any_command_what_produces_relative_path_names | cpio -pamVd /new/parent/dir |
Determine if the kernel is 32 bit or 64 bit | lshw -class cpu|grep "^ width"|uniq|awk '{print $2}' |
Create the directory '.npm-global' in the user's home directory(~). | mkdir ~/.npm-global |
Unzip "file.gz" to standard output and execute in bash with arguments "arguments" | gzip -d --stdout file.gz | bash /dev/stdin "arguments" |
Find all 1US* files/directories under current directory | find . -name '1US*' |
Display file type information for all instances of "file" in the current PATH. | which file | xargs file |
Set variable OS to the name of the operating system, ie. "Linux" | OS=$ |
Remove files under current directory with inode number $inum | find . -inum $inum -exec rm {} \; |
Search the /path directory tree for files lacking the group writable bit | find /path ! -perm /020 |
Save the FQDN host name of the system in variable "fhost" | fhost=`hostname -f` |
Search the current directory recursively for files last modified within the past 24 hours ignoring paths ./es* and ./en* | find . -mtime 0 | grep -v '^\./en' | grep -v '^\./es' |
Display the first 32 bytes in "foo" as printable characters with 16 characters per line | od -c foo |head -2 |
Gives the primary group of $USERNAME. | groups $USERNAME | cut -d\ -f 1 |
Look for any instance of "HIGHMEM" in the current kernel's compile-time config file. | grep “HIGHMEM” /boot/config-`uname -r` |
find files under the current directory ending in "txt" and list them, or ending in "html" but do nothing. | find . -name '*.txt' -print -o -name '*.html' |
Counts lines in file $FILE. | wc -l < $FILE |
Print last 10 commands in history with the first 7 characters removed | history 10 | cut -c 8- |
Find all files/directories named 'Waldo' under 'Books' directory tree that is located in user's home directory | find ~/Books -name Waldo |
set alias "no" for command "ls -f" | alias no=ls -f |
Count the *.html files residing in the /usr/src directory tree and containing string "foo" | find /usr/src -name "*.html" -exec grep -l foo '{}' ';' | wc -l |
Remove ESC key bind | bind -r '\e' |
find all the html files in the current folder and replace the end of each line with a pattern | find ./ -type f -name '*.html' | xargs sed -i '$s/$/<\/description>/' |
Find all files that are less than 50 bytes | find / -size -50c |
Make directorie(s) 'es_MX.utf8/LC_MESSAGES' as needed in the current directory | mkdir --parents ./es_MX.utf8/LC_MESSAGES |
Create a symbolic link in directory "~/newlinks" for each file listed in "results2.txt" | cat results2.txt | xargs -I{} ln -s {} ~/newlinks |
Find all files/directories in entire file system with 644 permission | find / -perm 644 |
Find all files/directories starting with 'onlyme' in their names under current directory tree in minimum 1 level deep | find . -mindepth 1 -name 'onlyme*' |
Find all executable symlinks or upvoter-* files under maximum 1 level down the {} directory | find {} -name 'upvoter-*' -type f -or -type l -maxdepth 1 -perm +111 |
Prints line count of each file within current directory. | find . -type f -print0 | xargs -0L1 wc -l |
find regular file named foo.txt under root / directory. | find / -name foo.txt -type f |
find all the files in current directory of size greater than 10MB and less than 20 MB. | find . -size +10M -size -20M |
Find all files under current directory and replace the match of the regex '^.*/S' with 'S' in every line of the output | find . -type f -print | sed 's|^.*/S|S|' |
Make directory and parents as needed for the directory name of file "$f" | mkdir -p -- "$" |
Calculate the md5 sum of "a" | echo "a" | md5sum |
find the type of all the regular/normal files in the current folder | find . -type f | xargs file |
Updates openssl package. | sudo yum update openssl |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.