General information
Use
unameto get system information:uname -a
-afor print all the information.
CPU information
Use
nprocto print the number of processing units available (GNU coreutils):$ nproc 4Use
lscputo display CPU architecture information (util-linux).
Disk information
dfis a powerful command for displaying system disk.df -h /path/to/directorycat /proc/partitions/andcat /proc/mountsare also pretty handly solutions to check the partitions and mount disks.
Memory information
Just as same as disk,
cat /proc/meminfocould 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.-mfor display in megabytes (as you expected, -g for gigabytes, -k for kilobytes.)
User activity information
lastcommand will display user’s info like terminal, time, date and so forth. To check one specific user’s activity,last usernameis what you are looking for.wis 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 Zwhere
ps auxto 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 theSTATand PID field, use grep to select the line containsZ(Zombie), now we get zombie processes pids. It’s easy to kill them bykill -9 {PID}.top/htop: Better not to use non-builtin command(for security reasons), but if you do want to,htopis a superior alternative totop– dynamically display current tasks.
Network information
To get your own public IP, both
curl icanhazip.comorcurl ifconfig.meare easy ways to do that(previous one is much faster).ping: Even my mother knows to usepingto 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 fromifconfig(tested on Ubuntu, Fedora, OmniOS and FreeBSD).lsof, aka list open files, is definitely a swiss army knife for analyzing network.lsof -ifor 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 userss -s: display Currently Established, Closed, Orphaned and Waiting TCP sockets
You may Also interested in
- My previous post A Primer to System Administration - Users and groups
- If you found any grammar misusage or typos, please help me correct by pull request here.