Operations 22 min read

Master Essential Linux Commands: From Navigation to File Management

This guide provides a comprehensive overview of common Linux commands for directory navigation, file manipulation, permission management, searching, compression, and system shutdown, complete with usage syntax, options, and practical examples to help users efficiently manage their Unix-like environments.

Raymond Ops
Raymond Ops
Raymond Ops
Master Essential Linux Commands: From Navigation to File Management

1. Common Commands

1.1 Directory Operations

ls – list directory contents.

Command: ls [options] [file|directory] Options: -a – show all files --color=when – color output (default always) -d – list directory entries themselves -h – human‑readable sizes -i – show inode number -l – long format # ls -l cd – change the current directory.

Command: cd [directory] Special symbols: ~ – home directory - – previous directory . – current directory .. – parent directory

pwd – print working directory.

Command:

pwd

1.2 File Operations

touch – create an empty file or update timestamps.

Command: touch filename stat – display detailed file status.

Command: stat filename cat – concatenate files and print to standard output.

Command:

cat [options] filename
-A

– show all hidden symbols -E – display end‑of‑line characters -n – number lines -T – show tabs as ^I -v – display non‑printing characters

more – page through a file.

Command: more filename Controls: Space (next page), b (previous page), Enter (next line), /string (search), q (quit).

less – similar to more but allows backward movement.

Command: less filename head – display the beginning of a file.

Command: head -n N filename tail – display the end of a file.

Command:

tail -n N filename

1.3 Directory and File Commands

mkdir – create a directory.

Command: mkdir [-p] directory rmdir – remove an empty directory.

Command: rmdir directory rm – remove files or directories.

Command: rm [-r] [-f] [-i] file|directory cp – copy files or directories.

Command: cp [-a] [-d] [-i] [-p] [-r] source destination mv – move or rename files/directories.

Command:

mv [-f] [-d] [-v] source destination

2. Permission Management

chmod – change file mode (permissions).

Command:

chmod [options] mode file
-R

– recursive

Permission syntax: [ugoa][+-=][rwx] (e.g., u+r).

Numeric mode: 4 = read, 2 = write, 1 = execute.

chown – change file owner and group.

Command:

chown [options] owner[:group] file
-R

– recursive

chgrp – change group ownership.

Command:

chgrp [options] group file

3. Help Commands

man – display manual pages.

Command:

man [options] command
-f

– show help level -k – search related help topics

info – view GNU info documentation.

help – show built‑in shell command help.

--help – display command‑specific help.

4. Search Commands

whereis – locate binary, source, and manual files.

Command: whereis name which – show the full path of an executable.

Command: which name locate – find files by name using a database.

Command: locate pattern find – search for files in a directory hierarchy.

Command:

find path [options] expression
-name

/ -iname – name match (case‑insensitive) -size [+|-]N – size criteria -atime / -mtime / -ctime – time criteria -perm – permission criteria -uid / -gid / -user / -group – owner/group -type d|f|l – file type -a, -o, -not – logical operators -exec – execute a command on found files -ok – like -exec but asks for confirmation

grep – search text using patterns.

Command:

grep [options] "pattern" file
-i

– ignore case -n – show line numbers -v – invert match --color=auto – highlight matches

Pipe (|) – pass output of one command as input to another.

5. Compression Commands

zip – package and compress files.

Command: zip [-r] archive.zip files unzip – extract zip archives.

Command: unzip [-d target_dir] archive.zip gzip – compress files using LZ77.

Command: gzip [-c] [-d] [-r] file gunzip – decompress gzip files (alias for gzip -d).

Command: gunzip file.gz tar – archive files; with -z or -j for compression.

Create archive: tar -cvf archive.tar files Extract archive: tar -xvf archive.tar Compressed with gzip: tar -zcvf archive.tar.gz files Compressed with bzip2:

tar -jcvf archive.tar.bz2 files

6. Shutdown and Reboot

sync – flush file system buffers.

Command: sync shutdown – schedule system halt or reboot.

Command:

shutdown [-h|-r] [+time] ["message"]
-c

– cancel a pending shutdown -h – halt -r – reboot

reboot – immediate reboot.

Command: reboot halt / poweroff – immediate power‑off (not recommended for graceful shutdown).

Command: halt or poweroff init – change runlevel (e.g., init 0 to halt, init 6 to reboot).

Command:

init [runlevel]
operationsshellbashcommand-linesystem-administration
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

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.