More Commands
system info
hostname # shows hostname
uname # shows UNIX name
uname -a # (all) shows more information
uptime # shows how long system has been running and CPU load averages
quota # shows disk quota (if any) on your account
df -h # shows disk space free in each mounted filesystem, human readable
du -hs /etc # shows disk space used in specified directory
# error messages from insufficient permissions
du -ks /etc 2> /dev/null # kilobytes, discards error messages
free # shows memory use (Linux only)
sensors # shows temps, fan speeds, etc. (Linux only)
vmstat # shows virtual memory use
less /proc/meminfo # detailed memory info
q # quit less
less /proc/cpuinfo # detailed CPU info
q # quit less
ls -d /proc/[a-z]* # more info
dates
date # shows time and date
date +%s # seconds since epoch (Jan 1 1970), many other format options
cal # shows calendar for current month
cal 4 2025 # shows calendar for Apr 2025
cal 2025 | less # shows calendar for all of 2025 CE
q # quit less
cal 3 | less # shows calendar for all of 3 CE
q # quit less
user info
whoami # shows your login name
id # shows UserID, GroupID, and groups
users # (similar to who, finger) shows users logged in
w # shows uptime, users logged in, and what they're doing
finger $USER # this shows information about you
chfn # (change full name) enter your password and full name when prompted
# just press the Enter key after the other prompts
cat > .plan # write a .plan file
# type a few lines of information about yourself
^D # terminate cat command
finger $USER # now shows the full name and .plan
finger stuart # this shows another user
last | less # shows recent logins
q # quit less
file utilities
tree /usr | less # list in tree format
q # quit less when done
tree -d /usr | less # show directories only
q # quit less when done
tree -L 1 /usr | less # (numeral 1) show 1 level only
q # quit less when done
wc /etc/passwd # count lines, words, characters
wc -l /etc/passwd # lines only
wc -w /etc/passwd # words only
wc -c /etc/passwd # chars only
wc -L /etc/passwd # length of longest line
file /etc/fstab # ASCII text
file /bin/gunzip # shell script
file /bin/ls # ELF 32-bit LSB executable (binary)
file /usr/man/man1/less.1.gz # gzip compressed data (man page for less)
od -ta /etc/fstab # shows non-printing chars as char names
od -tc /etc/fstab # shows non-printing chars as C escapes
strings -n16 /bin/dash | less # 16+ consecutive printing chars (in binary file)
q # quit less
cat > foo-0 # create a file (original)
line 1
lime 2 # misspelled
Ctrl+d
cat > foo-1 # create another file (new and improved)
line 1
line 2 # corrected
Ctrl+d
diff foo-0 foo-1 # show differences between two files (line editor format)
diff foo-0 foo-1 | tee foo-bar.diff # create and display update file
cmp -l foo-0 foo-1 # binary compare, -l shows which bytes differ
shred -n1 foo-0 # one pass, overwrite with random bytes, -z overwrites with zero bytes
od -tc foo-0 # garbage
rename foo- foo0- foo-* # pattern, replacement, file(s)
ls foo-*
rm foo* test.bin # clean up