General information

  1. Use uname to get system information:

    uname -a

    -a for print all the information.

CPU information

  1. Use nproc to print the number of processing units available (GNU coreutils):
$ nproc
4
  1. Use lscpu to display CPU architecture information (util-linux).

Disk information

  1. df is a powerful command for displaying system disk.
df -h /path/to/directory
  1. cat /proc/partitions/ and cat /proc/mounts are also pretty handly solutions to check the partitions and mount disks.

Memory information

  1. Just as same as disk, cat /proc/meminfo could easily check memory information (Thanks to Unix’s Everything is a file design concept).

  2. 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.)

User activity information

  1. 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.
  1. 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.

  2. uptime: Tell how long the system has been running.

  3. 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}.

  1. 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.

Network information

  1. 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).

  2. ping: Even my mother knows to use ping to check network connectivity.

  3. 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).

  4. 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
    
  1. ss -s: display Currently Established, Closed, Orphaned and Waiting TCP sockets

You may Also interested in

  1. My previous post A Primer to System Administration - Users and groups
  2. If you found any grammar misusage or typos, please help me correct by pull request here.

Reference

nodejs 部署最佳实践 by 邻家 柠檬叔

30 Useful Linux Commands for System Administrators

What does aux mean in ps aux?

Killing zombie process

An lsof Primer

Linux: Check Network Connection Command