nl stringlengths 13 387 | bash stringlengths 1 532 |
|---|---|
force remove all the text files that have not been modified in the last 89 days | find . -name "*.txt" -type f -daystart -mtime +89 | xargs rm -f |
Forcefully remove files *~important-file | rm -rf *~important-file |
forcibly and verbosely create a symbolic link named "target" to file "source" | ln -sfvn source target |
forcibly and verbosely create symbolic links in directory "~/Library/LaunchAgents" to all files located in /usr/local/opt/mongodb/ and that have filename extension ".plist" | ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents |
forcibly change owner to all files and directories in current directory to user www-data | sudo chown -Rf www-data * |
forcible create a symbolic link named "/etc/file.conf" to file "/etc/configuration/file.conf" | ln -fs /etc/configuration/file.conf /etc/file.conf |
forcibly create a symbolic link named "linkname" to file "new_destination" | ln -sf new_destination linkname |
Forcibly create symbolic links in target directory "~/staging" for all files located in directory "~/mirror" | ln --force --target-directory=~/staging ~/mirror/* |
Forcibly create symlink named as '/cygdrive/c/Users/Mic/mypics' to the directory '/cygdrive/c/Users/Mic/Desktop/PENDING - Pics/' | ln -sf '/cygdrive/c/Users/Mic/Desktop/PENDING - Pics/' '/cygdrive/c/Users/Mic/mypics' |
Forcibly removes ${temp} file. | rm --force "${temp}" |
Forcibly removes all files like '*.bak' and '*~' | rm -f *.bak *~ |
Format "$line" as a table | echo "$line" | column -t |
Format "file.txt" as space separated columns 28 characters in width | cat file.txt | column -c 28 -s "\ " |
Format and print the time string @133986838 according to the default time format | date --date @120024000 |
Format bash array "${arr}" in columns | echo " ${arr[@]/%/$'\n'}" | column |
Format the date represented by time string @1267619929 according to default format and print it | date -ud @1267619929 |
Format file "list-of-entries.txt" as new-line separated columns | column -t -s $'\n' list-of-entries.txt |
Format file "list-of-entries.txt" with no column delimiter | column -t -s '' list-of-entries.txt |
Format output of 'file' content to columns with wide not less than 80 pixels | cat file | column -c 80 |
Format tab delimited file "list-of-entries.txt" as a table | column -t -s $'\t' list-of-entries.txt |
Format tab separated fields in "FILE" as a table | column -t -s $'\t' FILE |
Format the time string $timestamp according to the format string "%Y-%m-%d %H:%M:%S" and save the output to variable 'CDATE' | CDATE=$( date -d @"$timestamp" +"%Y-%m-%d %H:%M:%S" ) |
Format the time string @133986838 according to the default time format and save it to variable 'VARIABLENAME' | VARIABLENAME=$(date -d @133986838) |
Forward all connections to client localhost 3307 via the SSH tunnel to gateway and then connect to host 1.2.3.4 to port 3306 | ssh -f user@gateway -L 3307:1.2.3.4:3306 -N |
Forward all connections to client localhost 3309 via the SSH tunnel to "mysql_access_server" and then connect to host "sqlmaster.example.com" on port 3306 | ssh -f mysql_access_server -L 3309:sqlmaster.example.com:3306 -N |
Forward port 12345 bound on 'localhost' to port 12345 on 'otherHost' as user 'otherUser' | ssh -f -N -L localhost:12345:otherHost:12345 otherUser@otherHost |
Forward port 3307 on localhost to port 3306 on 1.2.3.4 via 'user@gateway' on port 24222 | ssh -f user@gateway -p 24222 -L 3307:1.2.3.4:3306 -N |
Forward port 8000 bound on localhost to port 22 in 'clusternode' via 'user@bridge' | ssh -L localhost:8000:clusternode:22 user@bridge |
From a script, output the name of the script itself, without containing directories. | basename $0 |
From a script, output the name of the script itself, without containing directories - from a shell, output the name of the shell. | basename -- $0 |
From the list of words (one per line) in list1.txt, display the number of occurrences of this word in list2.txt and sort the results from highest to lowest count. | grep -Ff list1.txt list2.txt | sort | uniq -c | sort -n |
generates a list of all files beneath the current directory whose filename DOES NOT end in .html, so it matches files like *.txt, *.jpg, and so on. | find . -type f -not -name "*.html" |
Generates a randomly sorted list of numbers from 1 to 10. | seq 1 10 | sort -R | tee /tmp/lst |cat <(cat /tmp/lst) <(echo '-------') \ <(tac) |
Generates default-formatted file name of temporary file in a /dev/mapper folder, and saves path to it in a variable 'MAPPER'. | MAPPER=$(mktemp -up /dev/mapper) |
Generates name for temporary file with 6-letter suffix, and saves path to that new file in 'fn' variable. | fn=$(mktemp -u -t 'XXXXXX') |
Generate the obsolete 29 character Spanish alphabet and number each character | echo -e {{a..c},ch,{d..l},ll,{m,n},ñ,{o..z}}"\n" | nl |
Generate the Spanish alphabet and number each character | echo -e {{a..n},ñ,{o..z}}"\n" | nl |
Generates temporary file in a '/dev/shm' folder and saves path to it in a 'tFile' variable. | tFile=$(mktemp --tmpdir=/dev/shm) |
Generates temporary file name with full path by template 'fifo.XXXXXX' and saves it to variable 'fifo_name' | fifo_name=$(mktemp -u -t fifo.XXXXXX) |
Gets a current job back to the foreground. | fg |
Get a detailed list of all files on the system larger than 10MB | find / -size +10M -printf “%12s %t %h/%fn” |
Getting a detailed list of files/dirs | find / -name "apt" -ls |
Gets a job with defined number back to the foreground. | fg 1 |
Get a list of all files in the /home directory tree and their coressponding inode numbers | find /home -type f -printf "%i@%p\n" |
Get a list of all hidden files from the current directory tree | find . -type f -name '.*' |
Get a list of files and directories in the current directory tree | find . -print0 | xargs -0 echo |
get a PID of a process | jobs -x echo %1 |
Get A record for domain $domain | dig $domain |
Get A record for domain $domain | dig -t A $domain |
Get a recursive file list of directory $dir | find "$dir" -type f |
Get a recursive file list of directory $dir | find $dir -type f |
Get the actual find exectuable path | which find |
get all files in a current directory modified in the last 7 days | find . -mtime -7 -print0 | xargs -0 tar -cjf /foo/archive.tar.bz2 |
get all files in a current directory modified in the last 7 days | find . -mtime -7 -print0 | xargs -0 tar -rf /foo/archive.tar |
get all the files that are exactly 30 days old | find . -mtime 30 -print |
get all the files that have been modified within the last 30 days | find . -mtime -30 -print |
Gets all IP addresses from host network configuration and prints first one. | ifconfig | grep "inet addr:" | grep -v "127.0.0.1" | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1 |
Gets back to the foreground a job with number 2. | fg 2 |
Get the base filename from variable 'path', similar to using the basename command. | echo "$path" | rev | cut -d"/" -f1 | rev |
get the count of all the files that have been accessed in the last 30 days | find . -atime +30 -exec ls \; | wc -l |
Get current directory name without full path, ie. the part after the last / | basename "$(pwd)" |
Get directory listing of URL $1 and save them to variable 'header' by deleting '\r' characters | header="$(curl -sI "$1" | tr -d '\r')" |
Get the directory with least access time under current directory | find . -type d -printf "%A@ %p\n" | sort -n | tail -n 1 | cut -d " " -f 2- |
Get the disk space used by all *.txt (case insensitive) files/directories under current directory | find . -name "*.txt" -print0 |xargs -0 du -ch | tail -n1 |
Get the disk space used by all *.txt (case insensitive) files/directories under folder 1 and folder2 | find folder1 folder2 -iname '*.txt' -print0 | du --files0-from - -c -s | tail -1 |
Get domain name from dig reverse lookup. | $dig -x 8.8.8.8 | grep PTR | grep -o google.* |
Gets domain name from dig reverse lookup. | $dig -x 8.8.8.8 | grep PTR | grep -o google.* |
Gets domain name from dig reverse lookup. | dig -x 8.8.8.8 | grep PTR | cut -d ' ' -f 2 | grep google | cut -f 5 |
Get domain names from file '1.txt' and request TXT DNS record for each one | cat 1.txt | xargs dig TXT |
Get domain name with 'google' from address $1 | dig -x "$1" | grep PTR | cut -d ' ' -f 2 | grep google | cut -f 5 |
Get domain name with 'google' from address $IP | dig -x $IP | grep PTR | cut -d ' ' -f 2 | grep google | cut -f 5 |
Get files that last had their meta information changed more than 3 days ago | find / -ctime +3 |
get the git user access | su git |
Get the grandparent directory of each found 'pattern' file in $SEARCH_PATH | find "$SEARCH_PATH" -name 'pattern' | rev | cut -d'/' -f3- | rev |
Gets the groups these users belong to. | groups a b c d |
Gets IP address of ${NET_IF} network interface. | NET_IP=`ifconfig ${NET_IF} | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'` |
Gets IP address of 'eth0' network interface. | ifconfig eth0 | grep -oP '(?<= inet addr:)[^ ]+' |
Gets IP address of 'eth0' network interface. | ifconfig eth0 | grep inet | cut -d: -f2 | cut -d' ' -f1 |
Gets IP addresses of all active network interfaces. | ifconfig | grep -oP "(?<=inet addr:).*?(?= Bcast)" |
Gets IP addresses of all active network interfaces. | ifconfig | grep -oP "(?<=inet addr:).*?(?=Bcast)" |
Gets IP addresses of all active network interfaces and saves to 'ip' variable. | ip=$(ifconfig | grep -oP "(?<=inet addr:).*?(?=Bcast)") |
Gets IP address of first listed network interface in system. | ifconfig | grep 'inet addr:' | grep -v 127.0.0.1 | head -n1 | cut -f2 -d: | cut -f1 -d ' ' |
Gets list of IP addresses of all network interfaces. | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' |
Gets MAC address of 'eth0' network interface. | ifconfig eth0 | grep -Eo ..\(\:..\){5} |
Gets MAC address of 'eth0' network interface. | ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' |
Gets MAC address of 'eth0' network interface. | ifconfig eth0 | head -n1 | tr -s ' ' | cut -d' ' -f5 |
Gets MAC address of en0 network interface. | ifconfig en0 | grep -Eo ..\(\:..\){5} |
Gets MAC address of en0 network interface. | ifconfig en0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' |
Gets MAC address of eth0 network interface. | ifconfig eth0 | grep -Eoi [:0-9A-F:]{2}\(\:[:0-9A-F:]{2}\){5} |
Gets MAC address of eth0 network interface. | ifconfig eth0 | grep HWaddr | cut -d ' ' -f 9 |
Gets MAC address of eth0 network interface. | ifconfig | grep -i hwaddr | cut -d ' ' -f9 |
Get the number of "use" statements in all PHP files, ordered | find . -type f -name "*.php" -exec grep --with-filename -c "^use " {} \; | sort -t ":" -k 2 -n -r |
Get the number of regular files in the directory given as the bash script argument $1 | find $1 -type f | wc -l |
Get only the latest version of the file 'filename' under current directory | find . -name 'filename' | xargs -r ls -tc | head -n1 |
Get the path of running Apache | ps -ef | grep apache |
get the root access | sudo su |
get the root access | sudo su - |
get the root user access | sudo su |
get second-to-last comma-separated field of each line in file.txt | cat file.txt | rev | cut -d ',' -f 2 | rev |
Get the sizes (and total size) of all files under dir2 directory | find dir2 ! -type d |xargs wc -c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.