system info
cat /etc/issueshow linux distribution name
cat /proc/version show kernel version, etc..
cat /proc/cpuinfo processor information
cat /etc/passwd list users on the system
cat /etc/services list reserved ports
date display system time
date --date="-5 days" +%Y%m%d get date in the past & format output
hostname show current machine hostname
free show memory usage
uptime show time since the last boot
uname -a show information about system
hardware info
lspci list all PCI devices
lshw list all hardware
lshw -class network list network hardware
dmidecode List all hardware data from BIOS
users
whoami show current username
w / who show logged in users
finger user_name System info about user
write somuser Write a message to a logged in user
last show last logins on your system
lastb ("=last bad") show unsuccessful login attempts
drives
df -h show harddrive usage
mount show mount points
fdisk -l show harddrive and partition info
hdparm -t /dev/hdX show HD speed (~100MB/s is normal)
hdparm -iI /dev/hdX Harddrive information
files
pwd display current path
stat $filename show filesystem info about file
file $filename show file type information
time $command measure execution time of command
rename 's/\.png$/.jpg/' * batch rename files
du size of current directory
du --max-depth=1 list sizes of direct subdirs
tail -f /var/log/some watch log file changes
console commands debugging
which [cmd] show path of command [cmd]
ldd [path-to-cmd] show libraries used by [cmd]
package management
apt-cache search $regexp search available packages for $regexp
apt-get install [pkg] install package named [pkg]
send mails
mail -s "mail subject" some@one.com send email interactively. send = CTRL+D
mail -s "mail subject" some@one.com < mailbody.txt Send file contents as email
echo "bodytext" | mail -s "mail subject" some@one.com send mail, without need for a file
environment variables
PATH=some/new/path:$PATH Add something to the PATH variable