必須掌握的基礎命令
1. 查看幫助的命令
查看ls的幫助檔案
man ls
2.echo命令
echo命令用于在輸出字符或變數
格式 echo 字串 [&變數]
lin@lin-PC:~/compute$ echo one
one
lin@lin-PC:~/compute$ echo $SHELL
/bin/bash
3.date命令
顯示和設定系統的時間和日期
格式為 date [選項] [+指定格式]
lin@lin-PC:~/compute$ date
2020年 10月 17日 星期六 20:03:49 CST
4.cal命令
lin@lin-PC:~/compute$ cal
十月 2020
日 一 二 三 四 五 六
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
5.reboot 重啟
6.poweroff 關機
7.wget命令
-p 下載也免得所有資源,包括圖片視頻
-r 遞回下載
wget 就是下載的命令,跟上地址就可以了,也可以跟上引數
wget https://www.linuxprobe.com/docs/LinuxProbe.pdf -r -p
wget http://123.57.59.57/ -r -p
8.ps命令
ps命令用于查看系統中的行程狀態
ps [引數]
ps -a 顯示所有行程
ps -u 用戶以及其他資訊
ps -x
lin@lin-PC:~/compute$ ps -a
PID TTY TIME CMD
16594 pts/1 00:00:00 ps
lin@lin-PC:~/compute$ ps -u
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
lin 5465 0.0 0.0 11316 5336 pts/0 Ss+ 18:01 0:00 /bin/bash
lin 11965 0.0 0.0 11176 5008 pts/1 Ss 19:16 0:00 /bin/bash
lin 16605 0.0 0.0 11868 3288 pts/1 R+ 20:11 0:00 ps -u
9.top
top用戶動態地監視行程活動與系統負載
10.pidof命令
pidof命令用于查詢某個制定服務行程的PID值
pid [引數][服務名稱]
lin@lin-PC:~/compute$ pidof sshd
4155
10.kill命令
kill命令用來殺死行程
lin@lin-PC:~/compute$ kill 2156
系統狀態檢測命令
- 網卡網路
查看ip
lin@lin-PC:~/Desktop$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:52:7c:01 brd ff:ff:ff:ff:ff:ff
inet 172.18.4.141/21 brd 172.18.7.255 scope global dynamic noprefixroute ens33
valid_lft 7044sec preferred_lft 7044sec
inet6 fe80::d297:4fe6:59e8:b131/64 scope link noprefixroute
valid_lft forever preferred_lft forever
- 系統內核
lin-PC:~/Desktop$ uname -a
Linux lin-PC 5.4.50-amd64-desktop #74 SMP Mon Aug 24 20:15:37 CST 2020 x86_64 GNU/Linux
- 主機名
lin@lin-PC:~/Desktop$ who
lin tty1 2020-10-17 18:01 (:0)
lin@lin-PC:~/Desktop$ whoami
lin
4.uptime查看系統負載資訊
lin@lin-PC:~/Desktop$ uptime
20:27:05 up 2:26, 1 user, load average: 0.11, 0.18, 0.17
5.free查看系統中記憶體使用資訊
free -h
$ free -h
total used free shared buff/cache available
Mem: 15Gi 984Mi 13Gi 51Mi 1.2Gi 14Gi
Swap: 10Gi 0B 10Gi
6.last查看所有系統的登錄記錄
lin@lin-PC:~/Desktop$ last
lin tty1 :0 Sat Oct 17 18:01 still logged in
reboot system boot 5.4.50-amd64-des Sat Oct 17 18:00 still running
lin tty1 :0 Thu Oct 15 16:38 - crash (2+01:22)
reboot system boot 5.4.50-amd64-des Thu Oct 15 16:38 still running
lin tty1 :0 Thu Oct 15 14:22 - crash (02:15)
reboot system boot 5.4.50-amd64-des Thu Oct 15 14:21 still running
lin tty1 :0 Thu Oct 15 13:24 - 14:21 (00:56)
reboot system boot 5.4.50-amd64-des Thu Oct 15 13:24 - 14:21 (00:57)
- history 查看命令的歷史記錄
lin@lin-PC:~/Desktop$ history
1 sudo su -root
2 sudo su - root
3 ping www.baidu.com
4 ls
5 cd /root
6 ls
作業目錄切換命令
1. pwd命令
顯示用戶當前所處的作業目錄
@lin-PC:~/Desktop$ pwd
/home/lin/Desktop
2.cd命令 change directory
cd 回到根目錄
cd …回到上一級
cd /home 回到根目錄的home下
cd ~ 快速切換到用戶的家目錄
cd -回傳到上一次的目錄
3.ls 顯示目錄下的檔案資訊
lin@lin-PC:~/Desktop$ ls -al
總用量 1020
drwxr-xr-x 3 lin lin 4096 10月 17 19:16 .
drwxr-xr-x 28 lin lin 4096 10月 17 19:12 ..
-rw-r--r-- 1 lin lin 35 10月 15 14:30 待辦事項.txt
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/179305.html
標籤:其他
