This guide covers essential Linux commands for all users. Learn to navigate directories, manage files, monitor system resources, and troubleshoot problems, all from the command line. Commands are grouped for clarity, with practical examples for easy understanding.
Table of Contents
ls
)cd
, pwd
)mkdir
, rmdir
, rm
)touch
, cp
, mv
, rm
, cat
, less
, head
, tail
)ln
)ssh
)ssh -D
)ping
)whois
, dig
)wget
)date
, cal
)uptime
, w
, whoami
)uname
, /proc/cpuinfo
, /proc/meminfo
)df
, du
, free
)which
)history
)man
)ps
)kill
, killall
)bg
, fg
, jobs
)chmod
)chmod -R
)tar
Command (creating, extracting, listing)gzip
, bzip2
)grep
Command (searching files, directories, command output)locate
Command1. File and Directory Management
Mastering file and directory manipulation is crucial. These commands empower you to efficiently organize and work with your data.
1.1 Listing Directory Contents (ls
)
The ls
command displays directory contents. Use ls -l
for a detailed listing (permissions, size, modification date), and ls -a
to include hidden files. ls -al
combines both.
1.2 Navigating Directories (cd
, pwd
)
cd directory_name
changes the working directory. cd ..
moves up one level, and cd /
goes to the root directory. pwd
shows the current directory path.
1.3 Creating and Deleting Directories (mkdir
, rmdir
, rm
)
mkdir directory_name
creates a directory. mkdir -p
creates nested directories. rmdir directory_name
removes an empty directory. rm -r directory_name
recursively removes a directory and its contents (use with caution!).
1.4 Working with Files (touch
, cp
, mv
, rm
, cat
, less
, head
, tail
)
touch file.txt
creates an empty file or updates a file's timestamp. cp source destination
copies files. mv source destination
moves or renames files. rm file.txt
deletes a file. cat file.txt
displays file contents. less file.txt
displays large files page by page. head file.txt
shows the first 10 lines, tail file.txt
shows the last 10. tail -f file.txt
follows a growing file.
1.5 Creating Symbolic Links (ln
)
ln -s source_file link_name
creates a symbolic link (shortcut).
(Sections 2-9 would follow a similar structure, summarizing the key commands and their functionalities with concise descriptions and avoiding unnecessary repetition. The image would remain in its original format and location.)
The above is the detailed content of Fundamental Linux Commands For Newbies (2025 Update). For more information, please follow other related articles on the PHP Chinese website!