Linux常用命令2

2021-09-10 02:56:15 字數 2846 閱讀 3188

[root@localhost ~]# date

2023年 01月 21日 星期一 09:17:09 cst

[root@localhost ~]# date +%y/%m/%d

19/01/21

[root@localhost ~]# cal    //顯示當前日曆

一月 2019

日 一 二 三 四 五 六

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

[root@localhost ~]# cal 1 2019 //顯示2023年1月的日曆

一月 2019

日 一 二 三 四 五 六

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

[root@localhost ~]# bc

bc 1.06

this is free software with absolutely no warranty.

for details type `warranty'.

3/40 //此時無小數顯示

scale=3 //顯示3位小數

3/4.750

quit //退出計算器

[root@localhost ~]# /sbin/shutdown -引數 時間 '警告訊息『
-k : 不要真的關機,只是傳送警告訊息出去!

-r : 在將系統的服務停掉之後就重新啟動

-h : 將系統的服務停掉後,立即關機。

-n : 不經過 init 程式,直接以 shutdown的功能來關機

-f : 關機並開機之後,強制略過 fsck 的磁碟檢查

-f : 系統重新啟動之後,強制進行 fsck 的磁碟檢查

-c : 取消已經在進行的 shutdown 指令內容

例:[root@linux ~]#shutdown -h now

立刻關機,其中 now 相當於時間為 0 的狀態

[root@linux ~]# shutdown -h 20:25

系統在今天的 20:25 分會關機

[root@linux ~]# shutdown -h +10

系統再過十分鐘後自動關機

[root@linux ~]# shutdown -r now

系統立刻重新啟動

[root@linux ~]# shutdown -r +30 'the system will reboot'

再過三十分鐘系統會重新啟動,並顯示後面的訊息。

[root@linux ~]# shutdown -k now 'this system will reboot'

僅發出警告信件的引數!

rwxrw--wx   1   root    root        0            01-20   15:14   aa

檔案許可權 屬主 屬組 檔案大小

將aa擁有者改為test這個使用者

[root@localhost test]# chown test aa

[root@localhost test]# ls -l

-rwxrw--wx 1 test root 0 01-20 15:14 aa

例1:檢閱 /home/1.c的內容

[root@localhost test]# cat /home/1.c

#includeint main()

例2:在例1基礎上加上行號

[root@localhost test]# cat -n /home/1.c

1 #include2 int main()

3

[root@localhost test]# tac /home/1.c

}while(1);

{int main()

#include

[root@localhost ~]# more /etc/man.config
一頁一頁顯示根目錄下etc中man.config內容

空格鍵:代表下翻一頁

回車鍵:代表下翻一行

:f:顯示檔名及目前所在行數

q:離開more

[root@localhost ~]# less /etc/man.config
空格鍵:代表下翻一頁

pagedown:向下翻一頁

pageup:向上翻頁

q:離開less

[root@localhost /]# whereis ifconfig

ifconfig: /sbin/ifconfig /usr/share/man/man8/ifconfig.8.gz

例:編譯執行1.c

[root@localhost share]# gcc 1.c

[root@localhost share]# ./a.out

linux常用命令2

linux 啟動到文字介面 不啟動xwindows 介面vi etc inittab 在下面一行 id 5 initdefault 一行中的5改為 3啟動xwindows是5 文字介面是 3最後一次系統引導時間 who b 非正常關機的自動磁碟修復 etc sysconfig 裡增加乙個檔案 aut...

Linux常用命令(2)

壓縮命令 常用壓縮格式 zip gz bz2 tar.gz tar.bz2 zip格式 zip格式壓縮 注意 這裡的.zip格式和windows中的zip格式是一樣的,該格式檔案在兩個系統中是通用的 zip 壓縮檔案名 原始檔 壓縮檔案 zip r 壓縮檔案名 原始檔 壓縮目錄 zip格式解壓縮 u...

linux常用命令2

在linux環境下,壓縮檔案的副檔名通常為 tar tar.gz tgz gz bz2。而不同字尾名的檔案,則需要使用不同的命令處理。gz gzip命令壓縮的檔案 bz2 bzip2命令壓縮的檔案 tar tar命令打包的檔案 tar.gz tar打包後,再經過gzip壓縮的檔案 tar.bz2 t...