Essential Linux Commands
07/29/2008
Getting started on Linux can be challenging. Largely because the first time user won’t have any idea how to track down potential problems. The following Linux commands are essential to get additional information about your system when something goes wrong.
Machine info
- sudo lshw -html > hardware.html – Creates an HTML page showing what hardware is on your system
- uname -mr – Shows what kernel version and processor you are running on
- df -h and sudo fdisk -l – Gives you file system info. Can help you figure out how things are mounted
- sudo baobab – Graphical tool to help you figure out what is using disk space. (
sudo apt-get clean
may help free up some space)
Logs
- dmesg – Useful for tracking down problems during boot
- tail -f /var/log/messages – Now run the process giving you problems and you might see helpful error messages
Processes
- htop – Shows the programs which are the top memory and CPU users
- dstat -nf – Shows network traffic
- iostat -xk 2 – Shows IO statistics
- free -m – Shows how much memory is free. Linux uses 100% memory by default so as to not waste memory by letting it sit empty. Look at the buffers/cache line to see how much is really used.
- pgrep – Returns the process ids of a given program, allowing you to kill frozen programs
File transfer
- scp -i key.pem local_file user@remote_machine:remote_path – Securely transfers a file
In depth
If you’ve got other suggestions, please feel free to comment below. Thanks!
Leave A Comment