Linux 小知識點

來源:互聯網
上載者:User

標籤:blog   ar   使用   sp   檔案   div   on   log   bs   

1:目前的目錄比較重要的幾個檔案

...anaconda-ks.cfg.bash_history.bash_logout.bash_profile.bashrc.cshrcinstall.loginstall.log.syslog.tcshrc.viminfo

2:設定環境變數 $PATH通常定義在/etc/profile 或~/.bashrc中

export   PATH="PATH:/home/user/bin" 或者PATH="PATH:/home/user/bin"   export PATH

  

2:格式替換符號

printf "%-5s %-10s %-4s\n" No Name Mark
printf "%-5s %-10s %-4.2f\n" 1 Sarath 80.3456

%-5s 指明了一個格式為靠左對齊且寬度為 5 的字串替代(-表示靠左對齊)。如果不用-指定對齊,字串則採用靠右對齊形式。

%- 4.2f, 其中.2 指定保留2個小數位注意在每行格式字串後都有一個分行符號\n。

 

4:彩色列印

echo -e "\e[1; 42m Green   Background \e[0m"

要設定彩色背景,經常使用的顏色碼是:重設= 0,黑色= 40,紅色= 41,綠色= 42,黃色= 43, 藍色= 44,洋紅= 45,青色= 46,白色= 47。

 

5:擷取某進程的環境變數

pgrep my #擷取PID 例如為12500cat /proc/12500/environ

  

 

Linux 小知識點

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.