Linux概述
Linux是一個(gè)通用的操作系統(tǒng),操作系統(tǒng)是負(fù)責(zé)內(nèi)存分配、任務(wù)調(diào)度、處理外圍設(shè)備I/O等的操作,通常由內(nèi)核和系統(tǒng)程序兩部分組成。內(nèi)核是運(yùn)行其他程序,管理磁盤(pán)、打印機(jī)等硬件設(shè)備的核心程序;系統(tǒng)程序是指設(shè)備驅(qū)動(dòng)、shell、服務(wù)程序等。
Linux是由芬蘭人Linus Torvalds在1991年發(fā)布,是一個(gè)自由的操作系統(tǒng)。
Linux優(yōu)點(diǎn)
1.通用的操作系統(tǒng),不被特定的硬件設(shè)備所綁定。
2.源碼是C語(yǔ)言,可移植性強(qiáng),并由內(nèi)核編程接口。
3.可靠的安全性和穩(wěn)定性。
4.支持多用戶、多任務(wù),支持安全的分層文件系統(tǒng)。
......
目前Linux發(fā)行版本
Redhat、Ubuntu、Centos、Fedora、Debian、openSUSE
Linux基礎(chǔ)命令
Linux系統(tǒng)的命令通常是以下的格式:
命令名稱 [命名參數(shù)] [命令對(duì)象]
下面介紹一些Linux操作系統(tǒng)的基礎(chǔ)命令:
1.查看自己所使用的shell: ps
LxiindeMacBook-Pro:~ Lxiin$ ps
PID TTY TIME CMD
3768 ttys000 0:00.14 /bin/bash --rcfile /Applications/PyCharm.app/Contents/
4242 ttys001 0:00.07 -bash
shell是用戶與操作系統(tǒng)內(nèi)核交流的翻譯官,簡(jiǎn)單來(lái)說(shuō)是人與計(jì)算機(jī)交互的界面和接口。目前Linux系統(tǒng)默認(rèn)的shell都是bash,其可以使用tab鍵進(jìn)行命令和路徑補(bǔ)全,可以保存歷史命令,也可以進(jìn)行環(huán)境配置及執(zhí)行批處理的操作。
2.獲取用戶登錄信息:w/ who/ last
LxiindeMacBook-Pro:~ kingsoft$ w
23:27 up 1 day, 5:35, 2 users, load averages: 3.93 2.89 2.83
USER TTY FROM LOGIN@ IDLE WHAT
kingsoft console - 四18 29:18 -
kingsoft s001 - 18:11 - w
LxiindeMacBook-Pro:~ Lxiin$ who
Lxiin console May 30 18:09
Lxiin ttys001 May 31 18:11
LxiindeMacBook-Pro:~ Lxiin$ who am i
Lxiin ttys001 May 31 18:11
LxiindeMacBook-Pro:~ Lxiin$ last
Lxiin ttys001 Fri May 31 18:11 still logged in
Lxiin ttys001 Fri May 31 14:13 - 14:13 (00:00)
Lxiin ttys001 Fri May 31 13:08 - 13:08 (00:00)
Lxiin ttys001 Fri May 31 13:06 - 13:06 (00:00)
3.查看命令的說(shuō)明:whatis
LxiindeMacBook-Pro:~ Lxiin$ whatis clear
zmq_plain(7) - clear-text authentication
clear(1) - clear the terminal screen
4.查看命令的位置:which/whereis
LxiindeMacBook-Pro:~ Lxiin$ which python
/Library/Frameworks/Python.framework/Versions/3.7/bin/python
LxiindeMacBook-Pro:~ Lxiin$ whereis python
/usr/bin/python
5.查看命令的幫助文檔:man/info/help
PS(1) BSD General Commands Manual PS(1)
NAME
ps -- process status
SYNOPSIS
ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
[-g grp[,grp...]] [-u uid[,uid...]] [-p pid[,pid...]]
[-t tty[,tty...]] [-U user[,user...]]
ps [-L]
DESCRIPTION
···
LxiindeMacBook-Pro:~ Lxiin$ ps --help
ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
[-g grp[,grp...]] [-u [uid,uid...]]
[-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
ps [-L]
LxiindeMacBook-Pro:~ kingsoft$ info ps
···
6.查看系統(tǒng)和主機(jī)名:uname/hostname
LxiindeMacBook-Pro:~ Lxiin$ hostname
LxiindeMacBook-Pro.local
7.查看日期和時(shí)間:cal/date
LxiindeMacBook-Pro:~ Lxiin$ 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
LxiindeMacBook-Pro:~ Lxiin$ date
2019年 6月 1日 星期六 19時(shí)26分34秒 CST
8.退出登錄:exit/logout
LxiindeMacBook-Pro:~ Lxiin$ exit
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...21 completed.
9.查看歷史命令:history;執(zhí)行歷史命令:!+[num]
LxiindeMacBook-Pro:~ Lxiin$ history
···
502 clear
503 history
LxiindeMacBook-Pro:~ Lxiin$ !502
clear
10.重啟和關(guān)機(jī):reboot/shutdown