十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營(yíng)維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決

創(chuàng)新互聯(lián)主要從事網(wǎng)站建設(shè)、網(wǎng)站制作、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)吉利,10余年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18982081108
在Uinx 世界中,每一個(gè)管理員遲早都要使用命令行;例如,當(dāng)系統(tǒng)可能啟動(dòng)失敗后只給了一個(gè)命令行恢復(fù)模式。所以在這樣的環(huán)境種能夠使用命令行是一種基本的生存技能。
速覽啟動(dòng)命令解釋器
A command-line environment can be run from the graphical desktop, by an application known as a “terminal”. In GNOME, you can start it from the “Activities” overview (that you get when you move the mouse in the top-left corner of the screen) by typing the first letters of the application name. In Plasma, you will find it in the
K →
Applications →
System menu. 這一部分只會(huì)展示各個(gè)命令的簡(jiǎn)單用法,它們還有許多此處尚未描述的可用選項(xiàng)。請(qǐng)閱讀它們對(duì)應(yīng)的手冊(cè)頁,其中詳細(xì)的文檔可供你參考。
打開會(huì)話之后,
pwd 命令(
print working directory)會(huì)顯示當(dāng)前位置。當(dāng)前目錄可以通過
cd 目錄命令(
cd即
change directory)。上級(jí)目錄叫
..(兩個(gè)點(diǎn)),當(dāng)前目錄為
.(一個(gè)點(diǎn))。
ls 命令會(huì)
列舉目錄中的內(nèi)容,若沒有參數(shù),則其將對(duì)當(dāng)前目錄進(jìn)行操作。
$pwd/home/rhertzog $cd 桌面$pwd/home/rhertzog/桌面 $cd .$pwd/home/rhertzog/桌面 $cd ..$pwd/home/rhertzog $ls桌面 下載 圖片 模板 文檔 音樂 公共 視頻
您可以使用
mkdir 目錄名 命令創(chuàng)建一個(gè)新的目錄,且可以使用
rmdir 目錄名 命令刪除一個(gè)已存在的(空的)目錄。
mv 命令可以
移動(dòng)和/或重命名文件和目錄;
刪除一個(gè)文件可以使用
rm 文件名 命令來完成。
$mkdir test$ls桌面 下載 圖片 模板 視頻 文檔 音樂 公共 test $mv test new$ls桌面 下載 new 公共 視頻 文檔 音樂 圖片 模板 $rmdir new$ls桌面 下載 圖片 模板 視頻 文檔 音樂 公共
cat 文件名命令(用于
連接(concatenate)文件并將內(nèi)容送至標(biāo)準(zhǔn)輸出設(shè)備)讀取文件并將其內(nèi)容顯示在終端上。如果文件過大而不適合屏幕顯示的話,可以使用一個(gè)分頁器進(jìn)行輔助,例如
less(或者
more)以按頁在屏幕上顯示內(nèi)容。 The
editor command starts a text editor (such as
vi or
nano) and allows creating, modifying and reading text files. The simplest files can sometimes be created directly from the command interpreter thanks to redirection:
echo "text" >file creates a file named
file with “
text” as its contents. Adding a line at the end of this file is possible too, with a command such as
echo "moretext" >>file. Note the
>> in this example.
The
find directory criteria command looks for files in the hierarchy under
directory according to several criteria. The most commonly used criterion is
-name name: that allows looking for a file by its name. The
grep expression files command searches the contents of the files and extracts the lines matching the regular expression (see sidebar
BACK TO BASICS Regular expression). Adding the
-r option enables a recursive search on all files contained in the directory passed as a parameter. This allows looking for a file when only a part of the contents are known.
The
ps aux command lists the processes currently running and helps identifying them by showing their
pid (process id). Once the
pid of a process is known, the
kill -signal pid command allows sending it a signal (if the process belongs to the current user). Several signals exist; most commonly used are
TERM (a request to terminate gracefully) and
KILL (a forced kill). The command interpreter can also run programs in the background if the command is followed by a “&”. By using the ampersand, the user resumes control of the shell immediately even though the command is still running (hidden from the user; as a background process). The
jobs command lists the processes running in the background; running
fg %job-number (for
foreground) restores a job to the foreground. When a command is running in the foreground (either because it was started normally, or brought back to the foreground with
fg), the
Control+
Z key combination pauses the process and resumes control of the command-line. The process can then be restarted in the background with
bg %job-number (for
background).
The
free command displays information on memory;
df (
disk free) reports on the available disk space on each of the disks mounted in the filesystem. Its
-h option (for
human readable) converts the sizes into a more legible unit (usually mebibytes or gibibytes). In a similar fashion, the
free command supports the
-m and
-g options, and displays its data either in mebibytes or in gibibytes, respectively.
$freetotal used free shared buff/cache available Mem: 16279260 5910248 523432 871036 9845580 9128964 Swap: 16601084 240640 16360444 $dfFilesystem 1K-blocks Used Available Use% Mounted on udev 8108516 0 8108516 0% /dev tmpfs 1627928 161800 1466128 10% /run /dev/mapper/vg_main-root 466644576 451332520 12919912 98% / tmpfs 8139628 146796 7992832 2% /dev/shm tmpfs 5120 4 5116 1% /run/lock tmpfs 8139628 0 8139628 0% /sys/fs/cgroup /dev/sda1 523248 1676 521572 1% /boot/efi tmpfs 1627924 88 1627836 1% /run/user/1000
The
id command displays the identity of the user running the session, along with the list of groups they belong to. Since access to some files or devices may be limited to group members, checking available group membership may be useful.
$iduid=1000(rhertzog) gid=1000(rhertzog) groups=1000(rhertzog),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),108(netdev),109(bluetooth),115(scanner)