written on August 10, 2014
Use uname to get system information:
uname -a
-a for print all the information.
Use nproc to print the number of processing units available (GNU coreutils):
$ nproc
4
Use lscpu to display CPU architecture information (util-linux).
df is a powerful command for displaying system disk.
df -h /path/to/directory
cat /proc/partitions/ and cat /proc/mounts are also pretty handly solutions to check the partitions and mount disks.
Just as same as disk, cat /proc/meminfo could easily check memory information (Thanks to Unix’s Everything is a file design concept).
Alternatively, you can type free -m, which essentially is the same as check /meminfo. -m for display in megabytes (as you expected, -g for gigabytes, -k for kilobytes.)
last command will display user’s info like terminal, time, date and so forth. To check one specific user’s activity, last username is what you are looking for.
w is a great but rarely know command. It will display who is logged on and what they are doing. It’ll show username, terminal, from IP, login time, idle time, JCPU and the command line of their current process. If you never heard it before, I strongly suggest you to have a try.
uptime: Tell how long the system has been running.
ps: a well known command for checking current processes, for instance, to list all zombie process:
ps aux | awk '{ print $8 " " $2 }' | grep -w Z
where ps aux to show processes for all users, the process’s user, and also show the processes not attached to a terminal (check man page for more details), then awk to filter the STAT and PID field, use grep to select the line contains Z(Zombie), now we get zombie processes pids. It’s easy to kill them by kill -9 {PID}.
top/htop: Better not to use non-builtin command(for security reasons), but if you do want to, htop is a superior alternative to top – dynamically display current tasks.
To get your own public IP, both curl icanhazip.com or curl ifconfig.me are easy ways to do that(previous one is much faster).
ping: Even my mother knows to use ping to check network connectivity.
ifconfig: A frequently used tool to view network interface information. BTW, I wrote a script to filter IP, MAC addresses and networks from ifconfig (tested on Ubuntu, Fedora, OmniOS and FreeBSD).
lsof, aka list open files, is definitely a swiss army knife for analyzing network. lsof -i for list all open Internet and X.25 network files. (The examples below are from Daniel Miessler’s blog, see reference)
lsof -iTCP # Show only TCP connections
lsof -i:80 # Show networking only relate to port 80
lsof [email protected] # Show connections with particular IP
lsof -u username # Show given user's connections
lsof -u ^username # Show connections except given user
ss -s: display Currently Established, Closed, Orphaned and Waiting TCP sockets