Linux常用指令(pdf打印版一页A4)

本文提供了一份详尽的Linux命令速查表,涵盖了文件操作、进程管理、权限设置、搜索、系统信息查询、压缩、网络操作及安装等常用场景。通过这份指南,用户可以快速掌握并运用这些命令来提高工作效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

碎碎念:在CERN的时候,小导师Leonid说,打印一个Linux常用指令贴在显示器旁边,常见用法要牢记于心。

文末附上pdf

File Commands

ls – directory listing
ls -al – formatted listing with hidden files
cd dir - change directory to dir
cd – change to home
pwd – show current directory
mkdir dir – create a directory dir
rm file – delete file
rm -r dir – delete directory dir
rm -f file – force remove file
rm -rf dir – force remove directory dir *
cp file1 file2 – copy file1 to file2
cp -r dir1 dir2 – copy dir1 to dir2; create dir2 if it doesn’t exist
mv file1 file2 – rename or move file1 to file2
if file2 is an existing directory, moves file1 into directory file2
ln -s file link – create symbolic link link to file
touch file – create or update file
cat > file – places standard input into file
more file – output the contents of file
head file – output the first 10 lines of file
tail file – output the last 10 lines of file
tail -f file – output the contents of file as it grows, starting with the last 10 lines

Process Management

ps – display your currently active processes
top – display all running processes
kill pid – kill process id pid
killall proc – kill all processes named proc *
bg – lists stopped or background jobs; resume a stopped job in the background
fg – brings the most recent job to foreground
fg n – brings job n to the foreground

File Permissions

chmod octal file – change the permissions of file
to octal, which can be found separately for user,
group, and world by adding:
● 4 – read ®
● 2 – write (w)
● 1 – execute (x)
Examples:
chmod 777 – read, write, execute for all
chmod 755 – rwx for owner, rx for group and world
For more options, see man chmod.

SSH

ssh user@host – connect to host as user
ssh -p port user@host – connect to host on port
port as user
ssh-copy-id user@host – add your key to host for user to enable a keyed or passwordless login

Searching

grep pattern files – search for pattern in files
grep -r pattern dir – search recursively for
pattern in dir
command | grep pattern – search for pattern in the
output of command
locate file – find all instances of file

System Info

date – show the current date and time
cal – show this month’s calendar
uptime – show current uptime
w – display who is online
whoami – who you are logged in as
finger user – display information about user
uname -a – show kernel information
cat /proc/cpuinfo – cpu information
cat /proc/meminfo – memory information
man command – show the manual for command
df – show disk usage
du – show directory space usage
free – show memory and swap usage
whereis app – show possible locations of app
which app – show which app will be run by default
nvida -smi - 查看GPU运行情况

Compression

tar cf file.tar files – create a tar named file.tar containing files
tar xf file.tar – extract the files from file.tar
tar czf file.tar.gz files – create a tar with Gzip compression
tar xzf file.tar.gz – extract a tar using Gzip
tar cjf file.tar.bz2 – create a tar with Bzip2 compression
tar xjf file.tar.bz2 – extract a tar using Bzip2
gzip file – compresses file and renames it to file.gz
gzip -d file.gz – decompresses file.gz back to file
unzip file.gz – decompresses file.zip back to file

Network

ping host – ping host and output results
whois domain – get whois information for domain
dig domain – get DNS information for domain
dig -x host – reverse lookup host
wget file – download file
wget -c file – continue a stopped download

Installation

Install from source:

./configure
make
make install

dpkg -i pkg.deb – install a package (Debian)
rpm -Uvh pkg.rpm – install a package (RPM)

Shortcuts

Ctrl+C – halts the current command
Ctrl+Z – stops the current command, resume with fg in the foreground or bg in the background
Ctrl+D – log out of current session, similar to exit
Ctrl+W – erases one word in the current line
Ctrl+U – erases the whole line
Ctrl+R – type to bring up a recent command
!! - repeats the last command
exit – log out of current session

pdf打印版:

https://www.loggly.com/wp-content/uploads/2015/05/Linux-Cheat-Sheet-Sponsored-By-Loggly.pdf

Linux+命令行和shell脚本 虚拟机安装成功后,选择 ubuntu 64 ovf 双击再进行安装 安装完成后 虚拟机左边会出现 ubuntu 64 选择开启虚拟机 (如果报 64 位错误 需要修改 bios) 如果你的电脑没有打开虚拟化,需要重启电脑,开机之后 按 Delete 键(笔记本按 F2 或者其他键,具体根据电脑型号,有的不是常规按键需要查看说明书或者打电 话给客服) 进入 BIOS 模式,找到【CPU Configuration】选项.找到 CPU 虚拟化配置选项,这里是【Intel HT Technology】 选项 改为” Enable“启用虚拟化,改完之后 F10 保存 BIOS 配置,重启电脑之后再次打开虚拟机正常启动 虚拟机设置 1.左边控制条关闭 2.查看—->自动调整大小——>自动适应客户端 ubuntu14 本 登录操作系统—>了解操作系统——>创建自定义文件 ——>使用 vi 完成自定义文本内容输入(文件名称和内容) ——>查找创建的文件位于的路径 ——>文件的上传与下载 ——>学会使用配置文件(例如更改文件加载顺序) 中文输入法有问题 最左上边->搜索—>language—>语言支持->地区格式—>chinese—>保存退出 可以使用 tab 键来补命令 例如 输入 e 连续点击两次 tab 键,会见 e 开头的所有满足条件的显示出来 如果只有一个满足条件会进行补操作 开启终端:alt+ctrl+t 放大:ctrl+shift+’ +’ 缩小:ctrl+’ -‘ 同一屏幕开多个终端启:ctrl+shift+t mac 开启多个终端:command+t ubuntu 切换终端:ctrl+PgUp/PgDn mac 切换终端:command+shift+左/右 关闭触摸板:sudo modprobe -r psmouse
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Dr. 卷心菜

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值