nl
stringlengths
13
387
bash
stringlengths
1
532
Print file system disk space usage with sizes in powers of 1000
a=$( df -H )
Print file type information of the "java" executable
cat `which java` | file -
Print file type of the command "c++"
file `which c++`
Print file type of command "gcc"
file -L `which gcc`
Print file type of the executable file of command "file"
file `which file`
Print file type of the executable file of command "file"
which file | file -f -
Print file type of the executable file of command "python"
file `which python`
Print the files under current directory twice per line
find . -type f -exec echo {} {} \;
Prints file.txt without the last N bytes
head -c -N file.txt
Print the filenames taken by the glob pattern * with null character as the delimiter
find * -maxdepth 0 -type d -print0
Print the first 10 files or directories found in the /tmp directory tree by `find'
find /tmp | head
Print the first 10 files or directories found in the current directory tree by `find'
find | head
Print the first two bytes of "my_driver" in octal
od --read-bytes=2 my_driver
Print the first 2 lines of tree's help message by redirecting it from standard error to standard output
tree --help |& head -n2
Print the first 24 alphanumeric characters from "/dev/urandom", determining C locale for all categories
cat /dev/urandom | LC_ALL=C tr -dc 'a-zA-Z0-9' | fold -w 24 | head -n 1
Print the first 32 hexadecimal characters from "/dev/urandom"
cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32
Print the first 32 hexadecimal characters from "/dev/urandom", determining C locale for character handling functions
cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 32
Print the first 5 decompressed lines of compressed file "$line"
zcat "$line" | head -n5
Print first field from semicolon-seprated line <line>.
echo "<line>" | cut -d ";" -f 1
Prints first found folder that contains 'ssh' file and has 'bin' in path.
dirname `find / -name ssh | grep bin | head -1`
Print the first line of "filename" as a hex dump of characters
head -n 1 filename | od -c
Print the first line of "seq 1 10000"
seq 1 10000 | head -1
prints first line of $bigfile
head -n1 $bigfile
Print the first line of each file under the home directory
find $HOME/. -name *.txt -exec head -n 1 -v {} \;
Print the first line of every file matching pattern 'file?B' in the xargstest/ directory tree
find xargstest/ -name 'file?B' | sort | xargs head -n1
Print the first line of output after alphabetically sorting the file "set"
head -1 <(sort set)
Prints the first N bytes of file.txt
head -c N file.txt
Print first word of lines unique for 'file1' file
grep -o '^\S\+' <(comm file1 file2)
Prints folder path where $mystring file is located.
echo dirname: $(dirname $mystring)
Print fourth column of data from text file text.txt where columns separated by one or more whitespaces.
cat text.txt | tr -s ' ' | cut -d ' ' -f4
Print the full name of "$USER"
finger $USER |head -n1 |cut -d : -f3
Prints full path of a 'cat.wav' file in a current folder.
ls $PWD/cat.wav
Print the full path of a 'file.txt' file in the current folder.
ls "`pwd`/file.txt"
Print full path of command "c++"
which c++
Print the full path of command "cc"
which cc
Print the full path of command "gcc"
which gcc
Print full path of command "gradle"
which gradle
Print full path of command "programname"
which programname
Print full path of command "python"
which python
Print full path of command "python2.7"
which python2.7
Print the full path of command "rails"
which rails
Print the full path prefix for all files in the current directory tree as a list
tree -fi
Prints full path to files in a current folder.
ls -d $PWD/*
Prints full path to files in a current folder.
ls -d -1 $PWD/**
Print the full real path of "/dev/disk/by-uuid/$1" followed by "is mounted"
echo $(readlink -f /dev/disk/by-uuid/$1) is mounted
Print the full real path of "/dev/disk/by-uuid/$1" followed by "is not mounted"
echo $(readlink -f /dev/disk/by-uuid/$1) is not mounted
Print the grand total disk usage of all files listed in "files.txt"
cat files.txt | xargs du -c | tail -1
Print the grand total file system disk space usage with block sizes in units of TiB
df --total -BT | tail -n 1
Prints groups list that current user belongs to.
groups //take a look at the groups and see
Prints groups list that user 'el' belongs to.
groups el //see that el is part of www-data
Print groups of all users logged in
groups $(who | cut -d' ' -f 1)
Print the help message for tree
tree --help
Print the help message of command "split"
split --help
Prints help on 'cp' utility.
cp --help
Print the hexadecimal bytes and printable characters of "Hello world"
echo Hello world | od -t x1 -t c
Prints hierarchical process tree.
pstree
Print the host name
hostname
Print host name followed by ":" and the contents of "/sys/block/sda/size"
echo "$(hostname):$(cat /sys/block/sda/size)"
Print host name without a newline
echo -n `hostname`
Print info about all mounted file systems
df
Print info about all mounted file systems, and grand total statistic about available and used space
df --total
Print info about thread number of process with pid 1
cat /proc/1/sched | head -n 1
Prints information about active network interfaces in system.
echo "$(ifconfig)"
Prints information about user $euids currently on machine and its processes, without printing header.
w -h $euids
Print information of the process running the current script as the current user
ps -ef | grep $0 | grep $(whoami)
Print information of the root mount point
mount -v | grep " on / "
Print input "your, text, here" formatted to fit 70 characters per line breaking at spaces
echo 'your, text, here' | fold -sw 70
Print the IP addresses for the current host name
hostname -I
Print the IP addresses for the current host name
hostname -I | cut -f1 -d' '
Print the IP addresses for the current host name
hostname -i
Print IP addresses of the current host
hostname -I|cut -d" " -f 1
Print IP addresses of the host name
hostname -i
Print IP addresses of the host name
hostname --ip-address
Print IP addresses of the host name
hostname -I
Print IP addresses of the host name
hostname -I | cut -d' ' -f1
Print the IP addresses of the host name
hostname -I
Print joined strings from 'file', using space symbol as separator.
cat file | xargs
Prints Kb size of all top-level files and folders in a current folder in descending order.
du -ks * | sort -n -r
Prints Kb size of all top-level files and folders in a current folder in descending order in human readable format.
du -ksh * | sort -n -r
Print the kernel configuration options found in "/proc/config.gz"
cat /proc/config.gz | gunzip
Print last 10 commands in history with the first 7 characters removed
history 10 | cut -c 8-
Print the last 10 lines of "great-big-file.log"
tail great-big-file.log
Print the last 10 lines of '/var/log/syslog', printing out any additional data appended to the file
tail -f /var/log/syslog
Print the last 10 lines of the file '/var/log/syslog'
tail /var/log/syslog
Print last day of April, 2009
cal 4 2009 | tr ' ' '\n' | grep -v ^$ | tail -n 1
Print the last line of "$file1" to the console and append to "$file2"
tail -1 $file1 | tee -a $file2
Prints last modified file in a current folder.
find . -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "
prints the last non-empty line of a file
tac $FILE | grep -m 1 '.'
prints the last non-empty line of a file
tac FILE |egrep -m 1 .
Print the last space separated word from "Your string here"
echo "Your string here"| tr ' ' '\n' | tail -n1
Print the last space separated word from "a b c d e"
echo "a b c d e" | tr ' ' '\n' | tail -1
Prints latest modified file in a directory
ls -1t | head -1
Print lines 10000 to 10010 from input "seq 1 100000"
seq 1 100000 | tail -n +10000 | head -n 10
Print lines 16225 to 16482 in file "file"
cat file | head -n 16482 | tail -n 258
Print lines 347340107 through 347340206 in "filename"
tail -n +347340107 filename | head -n 100
Print lines containing string TEXT from all log files in the current directory.
grep -e TEXT *.log | cut -d':' --complement -s -f1
print the line containing TERMINATE and everything after in 'file'
tail -n "+$(grep -n 'TERMINATE' file | head -n 1 | cut -d ":" -f 1)" file
Prints lines count in each *.c file of a current folder and total count.
wc -l *.c
Prints lines count of each *.php file in a current folder and subfolders, and prints total count.
find . -name '*.php' -print0 | xargs -0 wc -l
Prints line count of each file within current directory.
find . -type f -print | xargs -L1 wc -l