溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

(一)Linux基本描述,基本命令以及環(huán)境變量

發(fā)布時間:2020-04-14 03:27:54 來源:網(wǎng)絡(luò) 閱讀:142 作者:qq5dbfcce11aa95 欄目:系統(tǒng)運(yùn)維

1 Linux 發(fā)行版

Linux 發(fā)行版(英語:Linux distribution,也被叫做GNU/Linux 發(fā)行版),為一般用戶預(yù)先集成好的Linux操作系統(tǒng)及各種應(yīng)用軟件。一般用戶不需要重新編譯,在直接安裝之后,只需要小幅度更改設(shè)置就可以使用,通常以軟件包管理系統(tǒng)來進(jìn)行應(yīng)用軟件的管理?,F(xiàn)在有超過300個Linux發(fā)行版(Linux發(fā)行版列表)。大部分都正處于活躍的開發(fā)中,不斷地改進(jìn)。
由于大多數(shù)軟件包是自由軟件和開源軟件,所以Linux發(fā)行版的形式多種多樣——從功能齊全的桌面系統(tǒng)以及服務(wù)器系統(tǒng)到小型系統(tǒng)(通常在嵌入式設(shè)備,或者啟動軟盤)。除了一些定制軟件(如安裝和配置工具),發(fā)行版通常只是將特定的應(yīng)用軟件安裝在一堆函數(shù)庫和內(nèi)核上,以滿足特定用戶的需求。

流行的發(fā)行版

基于Dpkg (Debian系)

商業(yè)發(fā)行版

        Ubuntu,一個非常流行的桌面發(fā)行版,由Canonical維護(hù)
        社群發(fā)行版
        Debian,一個強(qiáng)烈信奉自由軟件,并由志愿者維護(hù)的系統(tǒng)
        Kubuntu, 使用KDE桌面的Ubuntu
        Linux Mint,從Ubuntu派生并與Ubuntu兼容的系統(tǒng)
        Knoppix,第一個Live CD發(fā)行版,可以從可移動介質(zhì)運(yùn)行,Debian的派生版
        OpenGEU,Ubuntu的派生版
        Elementary OS:基于Ubuntu,接口酷似Mac OS X
        gOS和其他上網(wǎng)本用的系統(tǒng)

基于RPM (Red Hat系)

商業(yè)發(fā)行版

        Red Hat Enterprise Linux,F(xiàn)edora的商業(yè)版,由Red Hat維護(hù)和提供技術(shù)支持
        openSUSE,最初由Slackware分離出來,現(xiàn)在由Novell維護(hù)

社群發(fā)行版

        Fedora,是Red Hat的社區(qū)版,會經(jīng)常引入新特性進(jìn)行測試
        PCLinuxOS,Mandriva的派生版本,由社區(qū)維護(hù)的非常流行的發(fā)行版
        CentOS,從Red Hat發(fā)展而來的發(fā)行版,由志愿者維護(hù),旨在提供開源的,并與Red Hat 100%兼容的系統(tǒng)
        Mageia,從Mandriva發(fā)展而來的發(fā)行版

基于其他包格式

        ArchLinux,一個基于KISS(Keep It Simple and Stupid)的滾動更新的操作系統(tǒng)
        Chakra,一個從ArchLinux派生出來,只使用KDE桌面的半滾動更新發(fā)行版
        Gentoo,一個面向高級用戶的發(fā)行版,所有軟件的源代碼需要自行編譯
        Slackware,最早的發(fā)行版之一,1993年創(chuàng)建,由Patrick J. Volkerding維護(hù)

2 Linux常用命令格式

Linux系統(tǒng)常用命令格式: command[選項] [參數(shù)]

其中選項以-開始,多個選項可用一個-連起來,如ls -l -a與ls -la。根據(jù)命令的不同,參數(shù)分為可選的或必須的。

使用linux命令最主要的是要會使用命令幫助,常見的命令幫助有:
1.man command(系統(tǒng)手冊中的命令幫助)
2.info command(超級詳細(xì)的命令幫助)
3.command --help(shell內(nèi)部的命令幫助)
4.whatis(簡短的命令說明)
5.apropos(聯(lián)機(jī)模糊搜索)

Linux命令格式實(shí)例

cat

[root@svr-75# cat --help
Usage: cat [OPTION]... [FILE]...
Concatenate FILE(s), or standard input, to standard output.

  -A, --show-all           equivalent to -vET
  -b, --number-nonblank    number nonempty output lines, overrides -n
  -e                       equivalent to -vE
  -E, --show-ends          display $ at end of each line
  -n, --number             number all output lines
  -s, --squeeze-blank      suppress repeated empty output lines
  -t                       equivalent to -vT
  -T, --show-tabs          display TAB characters as ^I
  -u                       (ignored)
  -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
      --help     display this help and exit
      --version  output version information and exit

With no FILE, or when FILE is -, read standard input.

Examples:
  cat f - g  Output f's contents, then standard input, then g's contents.
  cat        Copy standard input to standard output.

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'cat invocation'

cat 命令用于連接文件并打印到標(biāo)準(zhǔn)輸出設(shè)備上。使用--help查詢cat命令的用法。(介于文檔都是英文的,學(xué)好英語很重要

一個實(shí)例,使用cat -n顯示出每個line屬于哪一行

[root@ansible-svr data]# cat welcome
This is a test file.
Welcome to the Linux World.
Hope you have a amazing journey with me.
[root@ansible-svr data]# cat -n welcome
     1  This is a test file.
     2  Welcome to the Linux World.
     3  Hope you have a amazing journey with me.

history

linux的history命令的作用是,記錄執(zhí)行過的命令。
用法:

* history [n] ?n為數(shù)字,列出最近的n條命令
* -c ?將目前shell中的所有history命令消除
* -a 將目前新增的命令寫入histfiles, 默認(rèn)寫入~/.bash_history
* -r ?將histfiles內(nèi)容讀入到目前shell的history記憶中
* -w 將目前history記憶的內(nèi)容寫入到histfiles

history命令可以修改輸出格式,下面是正常的輸出格式:

[root@ansible-svr ~]# history
    1  history

數(shù)字代表第一條歷史記錄,如果現(xiàn)在我們想更改輸出格式,使之可以顯示出時間,我們則可以用以下命令:

HISTTIMEFORMAT="%F %T "

我們再來看看history的輸出“

[root@ansible-svr ~]# history
    1 2019-11-01 01:32:24 history
    2 2019-11-01 01:34:24 HISTTIMEFORMAT="%F %T "
    3 2019-11-01 01:34:27 history

但是使用這段命令并不能永久保存,退出環(huán)境下次就不能生效,如何使之永久生效呢。這時候得配置永久的環(huán)境變量。

3 環(huán)境變量

上例代表臨時更改環(huán)境變量,那么如何永久更變環(huán)境變量呢。

profile文件:

修 改/etc/profile(對所有用戶都是有效的)
#vi /etc/profile
在里面加入:
export PATH="$PATH:/home/xyz/Tesseract/bin"

bashrc文件:

修改~/.bashrc文件。  (每個用戶目錄下都有,ls -all,單獨(dú)用戶有效)
cd ~
vi .bashrc
在里面加入:
export PATH="$PATH:/opt/au1200_rm/build_tools/bin"

永久設(shè)置方法一般需要重新注銷系統(tǒng)才能生效

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI