Operations 9 min read

Essential Linux Command-Line Tricks: Checksums, File Search, Process Management & More

This guide walks through practical Linux command-line techniques—including generating file checksums, locating files quickly, editing long commands, inspecting and managing processes, capturing terminal output, examining binary dependencies, and using various text‑viewing utilities—to boost everyday system administration efficiency.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Essential Linux Command-Line Tricks: Checksums, File Search, Process Management & More

1. View File Checksums

When copying or transferring files, verifying integrity is crucial; you can compare MD5, CRC, or generic sum values. Common commands are:

md5sum file_name
cksum file_name
sum algorithm_option file_name

Example with test.txt:

MD5: md5sum test.txt CRC: cksum test.txt Sum with system V algorithm: sum -r test.txt Sum with BSD algorithm: sum -s test.txt System V is the default when no option is given.

2. Locate Files

(1) locate

locate

searches a pre‑built database ( /var/lib/slocate) and is usually faster than find. Install it if missing (e.g.,

apt-get update
apt-get install mlocate

on Ubuntu) and use:

locate file_name

(2) find

find

can filter by name, type, owner, size, etc. Basic syntax: find path -option file_name Example to locate stdio.h:

find / -name stdio.h

3. Command‑Line Editing Shortcuts

To quickly clear a long, mistyped command, press Ctrl+U . Additional useful shortcuts:

Ctrl+K : delete from cursor to end of line.

Ctrl+A : move cursor to line start.

Ctrl+E : move cursor to line end.

4. View a Process PID

pidof process_name

5. Inspect Specific Process Activity

Use top with the PID to monitor a single process: top -p `pidof kcalc` Multiple processes can be listed by repeating -p `pidof …` options.

6. Terminate Processes

(1) kill

Find the PID with pidof then run:

kill -9 process_pid

(2) killall

Terminate by name directly:

killall process_name

7. Save Terminal Output to a File

(1) tee

Redirect output while still displaying it:

executable_file | tee log_file

(2) script

Record an entire session:

Start recording: script log.txt End recording: type

exit

(3) Terminal tools with built‑in logging

Some terminals (e.g., Terminator) provide a UI option to save logs.

8. View Dynamic Library Dependencies

ldd executable_file

9. Inspect ELF File Header

Use readelf -h to display architecture and other metadata, or file for a quick summary.

readelf -h elf_file

10. Text File Viewing Utilities

(1) cat

Displays file contents; -n adds line numbers.

cat -n /etc/profile

(2) tac

Shows file from bottom to top.

(3) more

Paginated view with progress percentage.

more file

(4) less

More flexible pagination; supports forward and backward navigation.

less file

(5) head

Shows the first n lines.

head -n 20 /etc/profile

(6) tail

Shows the last n lines.

tail -n 20 /etc/profile

(7) nl

Similar to cat -n, prints line numbers.

nl file

11. Set LD_LIBRARY_PATH

The environment variable tells the linker where to search for shared libraries. Append the current directory like this: export LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH These concise tips can streamline everyday Linux system work.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxSystem Administrationfile management
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.