Linux 命令备忘单 - 学习 Linux 命令Linux 命令备忘单 - 学习 Linux 命令Linux 命令备忘单 - 学习 Linux 命令Linux 命令备忘单 - 学习 Linux 命令
  • 业务
  • 目标
  • 支持
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容

Linux 命令备忘单 - 学习 Linux 命令

发表 admin at 2025年2月28日
类别
  • 未分类
标签

Linux 中的命令行终端是操作系统最强大的组件。然而,由于可用命令的数量巨大,这对于新手来说可能会令人生畏。即使是长期用户也可能偶尔会忘记某个命令,这就是我们创建此 Linux 备忘单命令指南的原因。 。

在这样的时刻,拥有按类别排序的 Linux 命令编译列表会非常方便。这样,当您忘记命令的确切语法时,只需几分钟即可引用该列表。

在本教程中,我们将向您展示最方便的 Linux 命令的精选列表。这些是一些最有用的命令,但并不是每个人都容易记住。下次当您在 Linux 终端上脑子一片空白时,请查看下面的 Linux 命令备忘单以获得一些快速帮助。

在本教程中您将学习:

  • Linux 命令备忘单

文件系统导航

Command Description
ls List all the files in a directory
ls -l List all files and their details (owner, mtime, size, etc)
ls -a List all the files in a directory (including hidden files)
pwd Show the present working directory
cd Change directory to some other location
file View the type of any file

查看、创建、编辑和删除文件和目录

Command Description
mkdir Create a new directory
touch Create a new, empty file, or update the modified time of an existing one
cat > file Create a new file with the text you type after
cat file View the contents of a file
grep View the contents of a file that match a pattern
nano file Open a file (or create new one) in nano text editor
vim file Open a file (or create new one) in vim text editor
rm or rmdir Remove a file or empty directory
rm -r Remove a directory that isn’t empty
mv Move or rename a file or directory
cp Copy a file or directory
rsync Synchronize the changes of one directory to another

搜索文件和目录

Command Description
locate Quickly find a file or directory that has been cached
find Seach for a file or directory based on name and other parameters

基本管理命令

Command Description
whoami See which user you are currently logged in as
sudo Execute a command with root permissions
sudo apt install Install a package on Debian based systems
sudo dnf install Install a package on Red Hat based systems
sudo apt remove Remove a package on Debian based systems
sudo dnf remove Remove a package on Red Hat based systems
reboot Reboot the system
poweroff Shut down the system

硬盘和存储命令

Command Description
df or df -h See the current storage usage of mounted partitions
sudo fdisk -l See information for all attached storage devices
du See disk usage of a directory’s contents
tree View the directory structure for a path
mount and umount Mount and unmount a storage device or ISO file

压缩命令

Command Description
tar cf my_dir.tar my_dir Create an uncompressed tar archive
tar cfz my_dir.tar my_dir Create a tar archive with gzip compression
gzip file Compress a file with gzip compression
tar xf file Extract the contents of any type of tar archive
gunzip file.gz Decompress a file that has gzip compression

联网命令

Command Description
ip a Show IP address and other information for all active interfaces
ip r Show IP address of default gateway
cat /etc/resolv.conf See what DNS servers your system is configured to use
ping Send a ping request to a network device
traceroute Trace the network path taken to a device
ssh Login to a remote device with SSH

文件权限和所有权

Command Description
chmod Change the file permissions for a file or directory
chown Change the owner of a file or directory
chgrp Change the group of a file or directory

用户管理命令

Command Description
useradd Low level utility for adding new user accounts
adduser High level utility for adding new user accounts
deluser Delete a user account
usermod Modify a user account
groupadd Create a new group
delgroup Delete a group

系统资源管理命令

Command Description
free -m See how much memory is in use and free
top See a list of processes and their resource usage
htop A more human readable and interactive version of top
nice Start a new process with a specified priority
renice Change the nice value of a currently running process
ps aux OR ps -ef View all of the currently running processes
kill or killall Terminate a process
kill -9 or killall -9 Terminate a process with SIGKILL signal
bg Send a task to the background
fg Bring a task to the foreground

环境变量命令

Command Description
printenv or printenv variable_name List all environment variables on a Linux system, or a specific one
whereis and which Find where a command in PATH is located
export MY_SITE="linuxconfig.org" Set a temporary environment variable (just an example, but use the same syntax)
echo $VARIABLE Display the value of a variable
unset Remove a variable

内核信息和模块管理

Command Description
uname -a Output detailed information about your kernel version and architecture
lsmod Find what modules are currently loaded
modinfo module_name Get information about any particular module
modprobe --remove module_name Remove a module
modprobe module_name Load a module into the kernel

硬件信息命令

Command Description
lspci See general information about host bridge, VGA controller, ethernet controller, USB controller, SATA controller, etc.
dmidecode See some information about BIOS, motherboard, chassis, etc.
cat /proc/cpuinfo Retrieve processor type, socket, speed, configured flags, etc.
x86info or x86info -a See information about the CPU
cat /proc/meminfo See detailed information about system RAM
lshw List all hardware components and see their configuration details
lshw -C memory -short Detect number of RAM slots used, speed, and size
hwinfo List details for all hardware, including their device files and configuration options
biosdecode Get some general information about your system’s BIOS
dmidecode -s bios-vendor Retrieve the name of your BIOS vendor with this simple command
lsusb Get a list of USB devices plugged into your system
ls -la /dev/disk/by-id/usb-* Retrieve a list of USB device files
hdparm -I /dev/sdx Get information about your hard drive’s make, model, serial number, firmware version, and configuration
hdparm -tT /dev/sdx Show the speed of an installed hard drive – including cached reads and buffered disk reads
wodim --devices Locate CD or DVD device file

结束语

当您需要快速复习时,请随时参考此备忘单。这里的目标是在尝试记住某个命令时为您节省尽可能多的时间。

每个用户都应该知道的另外两个命令是 man 命令和 apropos 命令。了解这两个使用起来非常简单的命令将允许您查找某些命令附带的所有选项。 apropos 还可以很好地用作手动搜索实用程序,因此您无需经常离开终端。

©2015-2025 Norria support@norria.com