- One of the best wallet AirTags I've tested isn't made by Apple (and it's on sale for Cyber Monday)
- Cyber Monday 2024 soundbar and speaker deals are ending soon: Sonos, Bose, Sony, and more
- Last chance to grab this great 'luxury' nugget ice maker for $150 off this Cyber Monday
- MRDIMM: Why your next server will have a new kind of memory
- 三井住友FG発のスタートアップの裏側、磯和CDIOが語る(後編)
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: