- Elevating Security: The Crucial Role of Effective API Management in Today's Digital Landscape
- This viral 'phone toaster' at CES can fully charge your handset in under 5 seconds - sort of
- CES 2025: The 25 best products that impressed us the most
- Google TVs are getting a major Gemini upgrade in 2025 - here are the 3 best features
- Slow home internet? 3 simple things I always check first for faster Wi-Fi
Linux fundamentals: Viewing files, commands, processes and systems
Comparing files
diff: compare files line by line
cmp: compare files byte by byte
comm: compare sorted files line by line
Linux provides several commands for comparing text files. If you run a command such as diff file1 file2 you’ll see the lines that are only in the first file preceded by < signs and those that are only in the second preceded by > signs. If you use the cmp command, you’ll just see where the differences in the files start (e.g, byte 25, line 4). No output means the files are identical. The comm command displays its output in an indented format – the leftmost column containing the common lines, the next displaying the lines in the first file only, and the last showing the lines in the second file only. The files’ contents should be in sorted order.
Viewing running processes
ps: display running processes
You can view processes on the system using the ps command. Without arguments, the output will only display the processes you are running. Use ps -ef or ps -aux to view all of the processes running on the system (i.e., as many as will fit into your terminal window).
top: display list of running processes in activity order
The top command will give you an idea how busy the system is overall. It will display things such as load averages, memory usage, the number of processes running and CPU usage in the first lines. This will be followed by a list of running processes showing those using the most system resources first five lines and then fill your terminal window with as many other processes as fit in your terminal window – all in system usage order. The display will update itself every few seconds or so.
Wrap-up
To learn more about Linux commands, you might want to get your hands on a Linux command cheat sheet. And if you’re using the bash shell, a bash cheat sheet can help you start writing scripts that allow you to automate routine tasks. Here are some options: