.bashrc和.vimrc以及一些比较有用的linux命令
生活随笔
收集整理的這篇文章主要介紹了
.bashrc和.vimrc以及一些比较有用的linux命令
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1.配置文件
讓自己的vim和shell更適合自己相關(guān)文件 .vimrc | .bashrc
路徑 ~/.vimrc | ~/.bashrc
功能 影響本用戶的vim | 影響本用戶的bash(ubuntu默認(rèn)shell 為 bash shell)
影響 覆蓋/etc/vimrc | 覆蓋bashrc文件
配置結(jié)束一般會在下次開機(jī)生效,想立即生效可使用 source+filename注意:
vim命令見樹狀圖,與常見IDE不同的是在vim中輸入Ctrl+s之后并不是保存文件,而是使vim進(jìn)入假死狀態(tài)停止向終端輸出,
需要按Ctrl+q再次激活才能使用;
相關(guān)命令:Ctrl+s 阻斷向終端輸出Ctrl+q 回復(fù)向終端輸出/***自己的一些.vimrc配置**/" Sets how many lines of history VIM has to remember
set history=60" display line number
set number" Enable syntax highlighting
syntax enablecolorscheme desert
set background=darklet mapleader = ","
let g:mapleader = ","" Disable highlight when <leader><cr> is pressed
map <silent> <leader><cr> :noh<cr>" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l" Enable filetype plugins
filetype plugin on
filetype indent on" Set 5 lines to the cursor - when moving vertically using j/k
set so=5" Ignore case when searching
set ignorecase" When searching try to be smart about cases
" 小寫字符忽略大小寫,有大寫字符則精確匹配
set smartcase" Highlight search results
set hlsearch" Makes search act like search in modern browsers
" 顯示實(shí)時(shí)搜索效果
set incsearch" Use spaces instead of tabs
set expandtab" Be smart when using tabs
set smarttab" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4set ai "autoindent
set si "Smart indent" 文件路徑 格式 文件類型 ascii碼 行列 百分比
set statusline=%F\ [%{&ff}]\ [%Y]\ [\%b/0x\%B]\ (%l,%v)[%p%%]" 這個(gè)命令會確保你的狀態(tài)條總會顯示在窗口的倒數(shù)第二行
set laststatus=2" 高亮匹配括號對,這樣當(dāng)你輸入右括號時(shí),光標(biāo)會暫時(shí)跳轉(zhuǎn)到左括號處閃爍
set showmatch" 簡單的調(diào)試用
namp <F10> osystem("echo \"\" >> ~/my.log");<Esc>16hi
iamp <F10> system("echo \"\" >> ~/my.log");<Esc>16hi" 備份文件的保存位置
set backupdir=/tmpset nonumber "不設(shè)置行號
set shell=/bin/bash "設(shè)置shell環(huán)境
syntax on "開啟vim語法高亮
colorscheme desert "設(shè)置主題色
set background=dark
set autoindent "設(shè)置自動縮進(jìn)
set nocompatible "不向下兼容vi
set showmatch "開啟括號匹配
"set cursorline "光標(biāo)所在行高亮
set ruler "設(shè)置標(biāo)尺
set laststatus=2 "開啟狀態(tài)欄(默認(rèn)是1)
set smartindent "開啟新航時(shí)使用智能自動縮進(jìn)
set hlsearch "搜索時(shí)高亮顯示找到的文本
set wrap "設(shè)置自動換行
set tabstop=4 "設(shè)置縮進(jìn)為4個(gè)空格
set softtabstop=4
set shiftwidth=4
filetype on "檢測文件類型
set history=500 "設(shè)置歷史行數(shù)
set smartindent "理想添加 依據(jù)上面的格式自動對齊" 解決一些亂碼問題
" 解決ssh輸出中文亂碼問題
set fileencodings=utf-8,gbk" 添加一些頭文件的目錄,使'g f'命令更好用
set path=.,/usr/include,一些自定義目錄/* 小例子開頭.bashrc */
/*******************************************小例子*****************************************************/
/*
*
*
* 作用: 輸入md 創(chuàng)建文件夾并進(jìn)入剛創(chuàng)建的文件夾
*
*/
md () {mkdir -p $1cd $1
}/********************************************end*****************************************************//* **自己的一些.bashrc配置**/#帶保險(xiǎn)的rm
alias rm='trash'
alias rl='trashlist'
alias ur='undelfile'
/* 我的系統(tǒng)是ubuntu16.0根據(jù)自己的系統(tǒng)更改~/.local/share/Trash/ 路徑 */
trash()
{ mv $@ ~/.local/share/Trash/
}
#顯示回收站中垃圾清單
trashlist()
{ ls -alt ~/.local/share/Trash/
}
#找回回收站相應(yīng)文件
undelfile()
{ mv -i ~/.local/share/Trash/ $@ ./
}
#清空回收站
cleartrash()
{ echo -ne "Clear all files in ~/.trash, Sure?[y/n]" read confirm if [ $confirm == 'y' -o $confirm == 'Y' ] ;then /bin/rm -rf ~/.local/share/Trash/* /bin/rm -rf ~/.local/share/Trash/.* 2>/dev/null fi
}/* 若是沒有安裝trash管理軟件使用一下別名 */
#先問在執(zhí)行
#原生命令
alias nativerm='/bin/rm'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'#現(xiàn)在最常用的文件夾
export J="/home/skange/code/haizeicourse/structure/"#中英文man手冊
alias eman='man -M /usr/share/man/'
alias man='man -M /usr/share/man/zh_CN/ '#刪除可執(zhí)行文件
alias clearallx='mv -i `ls -F | grep \* | cut -d \* -f 1 | grep -v ".sh" ` ~/.trash'#cd默認(rèn)路徑
export CDPATH=.:~:~/code:~/code/haizeicourse/#sh文件加可執(zhí)行權(quán)限
alias vimsh='touchsh'
touchsh()
{touch $1echo "#!/bim/bash" > $1 chmod u+x $1vim $1
}
#默認(rèn)創(chuàng)建父文件夾
# -> Prevents accidentally clobbering files.
alias mkdir='mkdir -p'
#-------------------------------------------------------------
alias h='history'
alias j='jobs -l'
alias which='type -a'
alias ..='cd ..'
#-------------------------------------------------------------
# Pretty-print of some PATH variables:
alias path='echo -e ${PATH//:/\\n}'
alias libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}'
#-------------------------------------------------------------
alias du='du -kh' # Makes a more readable output.
alias df='df -kTh'
#
#-------------------------------------------------------------
# The 'ls' family (this assumes you use a recent GNU ls).
#-------------------------------------------------------------
# Add colors for filetype and human-readable sizes by default on 'ls':
alias ls='ls -hF --color'
alias lx='ls -lXB' # Sort by extension.
alias lk='ls -lSr' # Sort by size, biggest last.
alias lt='ls -ltr' # Sort by date, most recent last.
alias lc='ls -ltcr' # Sort by/show change time,most recent last.
alias lu='ls -ltur' # Sort by/show access time,most recent last.
alias l='ls -CF' # Sort by/show access time,most recent last.
#
# The ubiquitous 'll': directories first, with alphanumeric sorting:
alias ll="ls -lv --group-directories-first"
alias lm='ll |more' # Pipe through 'more'
alias lr='ll -R' # Recursive ls.
alias la='ll -A' # Show hidden files.
alias tree='tree -Csuh' # Nice alternative to 'recursive ls' ...
#-------------------------------------------------------------
alias dir="ls" # 模擬windows
alias lrd="ls -lR|grep '^[dl]'" # 遞歸列出所有的目錄,包括鏈接
alias lsd="ls -l|grep '^[dl]'" # 列出所有的目錄,包括鏈接/****常見命令***/
/***************************************************man*************************************************/
man 手冊 匹配一個(gè)之后停止
man -a 強(qiáng)制顯示所有匹配內(nèi)容
man -f ==> whatis
/***************************************************whereis*************************************************/
whereis 查詢文件存儲位置-b 只顯示二進(jìn)制文件-f 只顯示文件的真實(shí)名稱-m 只查找?guī)椭募?s 只查找source文件-M dir 設(shè)置查找目錄-S dir 設(shè)置查找目錄
/***************************************************dmesg*************************************************/
dmesg 檢測和控制內(nèi)核的緩存,通常用來顯示輸出系統(tǒng)最后一次啟動時(shí)內(nèi)核的內(nèi)部緩存信息
dmesg [-c] [-n level] [-s bufsize]-c 顯示信息后清空緩沖區(qū)中的信息-s bufsize 設(shè)置查詢所需的緩沖區(qū)大小,不設(shè)置默認(rèn)是16392-n level 設(shè)置日志信息輸出的級別 -------設(shè)置 -n 1將只顯示輸出panic(恐慌)級別信息/***************************************************lsmod*************************************************/
lsmod 顯示出所有已加載的模塊
判斷是否正確加載內(nèi)核給的模塊/***************************************************pstree*************************************************/
pstree 看代碼理思路的神器,讓運(yùn)行的系統(tǒng)告訴你它是怎樣運(yùn)行的-a 顯示進(jìn)程完成的進(jìn)程及參數(shù)-p 顯示進(jìn)程的進(jìn)程號-c 不進(jìn)行精簡,即不對同等的子樹進(jìn)行壓縮-h 高亮顯示正在執(zhí)行的進(jìn)程及其父進(jìn)程-p 顯示進(jìn)程標(biāo)識符-u 顯示用戶名稱-l 不對過長的記錄進(jìn)行裁剪-n 以PID進(jìn)行排序--user 顯示指定用戶的子樹
例如:
andrew@andrew-Thurley:~/work$ pstree
systemd─┬─NetworkManager─┬─dhclient│ ├─dnsmasq│ ├─{gdbus}│ └─{gmain}├─accounts-daemon─┬─{gdbus}│ └─{gmain}├─acpid├─atd├─avahi-daemon───avahi-daemon├─bluetoothd├─colord─┬─{gdbus}│ └─{gmain}├─cron├─cups-browsed─┬─{gdbus}│ └─{gmain}├─cupsd───dbus├─dbus-daemon├─fwupd─┬─{GUsbEventThread}│ ├─{fwupd}│ ├─{gdbus}│ └─{gmain}├─gnome-keyring-d─┬─{gdbus}│ ├─{gmain}│ └─{timer}├─irqbalance├─lightdm─┬─Xorg───{InputThread}│ ├─lightdm─┬─upstart─┬─at-spi-bus-laun─┬─dbus-daemon│ │ │ │ ├─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─at-spi2-registr─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─bamfdaemon─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─code─┬─code─┬─code─┬─code─┬─{TaskSchedu+│ │ │ │ │ │ │ └─7*[{code}]│ │ │ │ │ │ ├─code─┬─{TaskSchedu+│ │ │ │ │ │ │ └─8*[{code}]│ │ │ │ │ │ ├─{Chrome_ChildIOT}│ │ │ │ │ │ ├─3*[{CompositorTile+│ │ │ │ │ │ ├─{Compositor}│ │ │ │ │ │ ├─{DedicatedWorker}│ │ │ │ │ │ ├─{GpuMemoryThread}│ │ │ │ │ │ ├─{Renderer::FILE}│ │ │ │ │ │ ├─{TaskSchedulerRe}│ │ │ │ │ │ ├─{TaskSchedulerSe}│ │ │ │ │ │ └─9*[{code}]│ │ │ │ │ └─code─┬─{Chrome_ChildIOT}│ │ │ │ │ ├─3*[{CompositorTile+│ │ │ │ │ ├─{Compositor}│ │ │ │ │ ├─{GpuMemoryThread}│ │ │ │ │ ├─{Renderer::FILE}│ │ │ │ │ ├─{TaskSchedulerRe}│ │ │ │ │ ├─{TaskSchedulerSe}│ │ │ │ │ └─7*[{code}]│ │ │ │ ├─code─┬─{Chrome_ChildIOT}│ │ │ │ │ ├─{TaskSchedulerCo}│ │ │ │ │ ├─{TaskSchedulerSe}│ │ │ │ │ └─{Watchdog}│ │ │ │ ├─{AudioThread}│ │ │ │ ├─{Chrome_IOThread}│ │ │ │ ├─{CompositorTileW}│ │ │ │ ├─{CrShutdownDetec}│ │ │ │ ├─{D-Bus thread}│ │ │ │ ├─{NetworkChangeNo}│ │ │ │ ├─2*[{TaskSchedulerBa}]│ │ │ │ ├─2*[{TaskSchedulerFo}]│ │ │ │ ├─{TaskSchedulerSe}│ │ │ │ ├─6*[{TaskSchedulerSi}]│ │ │ │ ├─9*[{code}]│ │ │ │ ├─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ ├─{gmain}│ │ │ │ ├─{inotify_reader}│ │ │ │ ├─{sandbox_ipc_thr}│ │ │ │ └─{threaded-ml}│ │ │ ├─compiz─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ ├─{gmain}│ │ │ │ └─4*[{pool}]│ │ │ ├─2*[dbus-daemon]│ │ │ ├─dconf-service─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─evolution-addre─┬─evolution-addre─┬─{dc+│ │ │ │ │ ├─{ev+│ │ │ │ │ ├─{gd+│ │ │ │ │ └─{gm+│ │ │ │ ├─{dconf worker}│ │ │ │ ├─{evolution-addre}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─evolution-calen─┬─evolution-calen─┬─{dc+│ │ │ │ │ ├─{ev+│ │ │ │ │ ├─{gd+│ │ │ │ │ └─{gm+│ │ │ │ ├─evolution-calen─┬─{dc+│ │ │ │ │ ├─2*[+│ │ │ │ │ ├─{gd+│ │ │ │ │ ├─{gm+│ │ │ │ │ └─{po+│ │ │ │ ├─{dconf worker}│ │ │ │ ├─{evolution-calen}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─evolution-sourc─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─fcitx───{fcitx}│ │ │ ├─fcitx-dbus-watc│ │ │ ├─firefox─┬─Web Content─┬─{AudioIPC Clien+│ │ │ │ │ ├─{AudioIPC0}│ │ │ │ │ ├─{AudioIPC1}│ │ │ │ │ ├─{Cameras IPC}│ │ │ │ │ ├─{Chrome_~dThrea+│ │ │ │ │ ├─{DOM File}│ │ │ │ │ ├─{DOM Worker}│ │ │ │ │ ├─{GMPThread}│ │ │ │ │ ├─{HTML5 Parser}│ │ │ │ │ ├─{ImageBr~geChil+│ │ │ │ │ ├─{ImageIO}│ │ │ │ │ ├─{ImgDecoder #1}│ │ │ │ │ ├─{ImgDecoder #2}│ │ │ │ │ ├─4*[{JS Helper}]│ │ │ │ │ ├─{JS Watchdog}│ │ │ │ │ ├─{MediaManager}│ │ │ │ │ ├─{ProcessHangMon+│ │ │ │ │ ├─{ProfilerChild}│ │ │ │ │ ├─{ProxyResolutio+│ │ │ │ │ ├─{SCTP iterator}│ │ │ │ │ ├─{SCTP timer}│ │ │ │ │ ├─{Socket Thread}│ │ │ │ │ ├─{StyleThread#0}│ │ │ │ │ ├─{StyleThread#1}│ │ │ │ │ ├─{StyleThread#2}│ │ │ │ │ ├─{SysProxySettin+│ │ │ │ │ ├─{Timer}│ │ │ │ │ ├─{VideoChild}│ │ │ │ │ └─{dconf worker}│ │ │ │ ├─Web Content─┬─{AudioIPC Clien+│ │ │ │ │ ├─{AudioIPC0}│ │ │ │ │ ├─{AudioIPC1}│ │ │ │ │ ├─{Cameras IPC}│ │ │ │ │ ├─{Chrome_~dThrea+│ │ │ │ │ ├─{DOM File}│ │ │ │ │ ├─{DOM Worker}│ │ │ │ │ ├─{HTML5 Parser}│ │ │ │ │ ├─{ImageBr~geChil+│ │ │ │ │ ├─{ImageIO}│ │ │ │ │ ├─{ImgDecoder #1}│ │ │ │ │ ├─{ImgDecoder #2}│ │ │ │ │ ├─4*[{JS Helper}]│ │ │ │ │ ├─{JS Watchdog}│ │ │ │ │ ├─{MediaManager}│ │ │ │ │ ├─{ProcessHangMon+│ │ │ │ │ ├─{ProfilerChild}│ │ │ │ │ ├─{Socket Thread}│ │ │ │ │ ├─{StyleThread#0}│ │ │ │ │ ├─{StyleThread#1}│ │ │ │ │ ├─{StyleThread#2}│ │ │ │ │ ├─{Timer}│ │ │ │ │ ├─{VideoChild}│ │ │ │ │ └─{dconf worker}│ │ │ │ ├─Web Content─┬─{Chrome_~dThrea+│ │ │ │ │ ├─{DOM File}│ │ │ │ │ ├─{ImageBr~geChil+│ │ │ │ │ ├─{ImageIO}│ │ │ │ │ ├─{ImgDecoder #1}│ │ │ │ │ ├─4*[{JS Helper}]│ │ │ │ │ ├─{JS Watchdog}│ │ │ │ │ ├─{ProcessHangMon+│ │ │ │ │ ├─{ProfilerChild}│ │ │ │ │ ├─{Socket Thread}│ │ │ │ │ ├─{Timer}│ │ │ │ │ ├─{VideoChild}│ │ │ │ │ └─{dconf worker}│ │ │ │ ├─{AudioIPC Callba}│ │ │ │ ├─{AudioIPC Server}│ │ │ │ ├─{Cache I/O}│ │ │ │ ├─{Cache2 I/O}│ │ │ │ ├─{Classif~ Update}│ │ │ │ ├─{Compositor}│ │ │ │ ├─{Cookie}│ │ │ │ ├─3*[{DOM Worker}]│ │ │ │ ├─4*[{DataStorage}]│ │ │ │ ├─{FS Broker 351}│ │ │ │ ├─{FS Broker 8431}│ │ │ │ ├─{FS Broker 8721}│ │ │ │ ├─{FileBlockCache}│ │ │ │ ├─{GMPThread}│ │ │ │ ├─{Gecko_IOThread}│ │ │ │ ├─{HTML5 Parser}│ │ │ │ ├─{IPDL Background}│ │ │ │ ├─{ImageBr~geChild}│ │ │ │ ├─{ImageIO}│ │ │ │ ├─{ImgDecoder #1}│ │ │ │ ├─{ImgDecoder #2}│ │ │ │ ├─{InotifyEventThr}│ │ │ │ ├─4*[{JS Helper}]│ │ │ │ ├─{JS Watchdog}│ │ │ │ ├─{Link Monitor}│ │ │ │ ├─{MediaCache}│ │ │ │ ├─{ProcessHangMon}│ │ │ │ ├─{ProxyResolution}│ │ │ │ ├─{QuotaManager IO}│ │ │ │ ├─{SaveScripts}│ │ │ │ ├─{Socket Thread}│ │ │ │ ├─{Softwar~cThread}│ │ │ │ ├─{StyleThread#0}│ │ │ │ ├─{StyleThread#1}│ │ │ │ ├─{StyleThread#2}│ │ │ │ ├─{SysProxySetting}│ │ │ │ ├─{Timer}│ │ │ │ ├─{URL Classifier}│ │ │ │ ├─{VRListener}│ │ │ │ ├─{VideoCapture}│ │ │ │ ├─{dconf worker}│ │ │ │ ├─2*[{firefox}]│ │ │ │ ├─{gdbus}│ │ │ │ ├─{gmain}│ │ │ │ ├─{localStorage DB}│ │ │ │ ├─{mozStorage #1}│ │ │ │ ├─{mozStorage #2}│ │ │ │ ├─{mozStorage #3}│ │ │ │ ├─{mozStorage #4}│ │ │ │ ├─{mozStorage #5}│ │ │ │ ├─{mozStorage #6}│ │ │ │ └─2*[{threaded-ml}]│ │ │ ├─gconfd-2│ │ │ ├─gnome-session-b─┬─deja-dup-monito─┬─{dc+│ │ │ │ │ ├─{gd+│ │ │ │ │ └─{gm+│ │ │ │ ├─gnome-software─┬─{dco+│ │ │ │ │ ├─{gdb+│ │ │ │ │ └─{gma+│ │ │ │ ├─nautilus─┬─{dconf wor+│ │ │ │ │ ├─{gdbus}│ │ │ │ │ ├─{gmain}│ │ │ │ │ └─4*[{pool}]│ │ │ │ ├─nm-applet─┬─{dconf wo+│ │ │ │ │ ├─{gdbus}│ │ │ │ │ └─{gmain}│ │ │ │ ├─polkit-gnome-au─┬─{dc+│ │ │ │ │ ├─{gd+│ │ │ │ │ └─{gm+│ │ │ │ ├─unity-fallback-─┬─{dc+│ │ │ │ │ ├─{gd+│ │ │ │ │ └─{gm+│ │ │ │ ├─update-notifier─┬─{dc+│ │ │ │ │ ├─{gd+│ │ │ │ │ └─{gm+│ │ │ │ ├─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gnome-terminal-─┬─bash───grep│ │ │ │ ├─bash───pstree│ │ │ │ ├─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gpg-agent│ │ │ ├─gvfs-afc-volume─┬─{gdbus}│ │ │ │ ├─{gmain}│ │ │ │ └─{gvfs-afc-volume}│ │ │ ├─gvfs-goa-volume─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gvfs-gphoto2-vo─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gvfs-mtp-volume─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gvfs-udisks2-vo─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gvfsd─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gvfsd-dnssd─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gvfsd-fuse─┬─{gdbus}│ │ │ │ ├─{gmain}│ │ │ │ ├─{gvfs-fuse-sub}│ │ │ │ └─2*[{gvfsd-fuse}]│ │ │ ├─gvfsd-metadata─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gvfsd-network─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gvfsd-smb-brows─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─gvfsd-trash─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─hud-service─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─indicator-appli─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─indicator-bluet─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─indicator-datet─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ ├─{gmain}│ │ │ │ ├─{indicator-datet}│ │ │ │ └─{pool}│ │ │ ├─indicator-keybo─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─indicator-messa─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─indicator-power─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─indicator-print─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─indicator-sessi─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─indicator-sound─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─notify-osd─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─pulseaudio─┬─{alsa-sink-ALC26}│ │ │ │ └─{alsa-source-ALC}│ │ │ ├─sh───zeitgeist-daemo─┬─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─sogou-qimpanel─┬─3*[{QInotifyFileSys}]│ │ │ │ ├─2*[{QThread}]│ │ │ │ └─5*[{sogou-qimpanel}]│ │ │ ├─sogou-qimpanel-│ │ │ ├─unity-panel-ser─┬─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─unity-settings-─┬─check_gl_textur│ │ │ │ ├─syndaemon│ │ │ │ ├─{dconf worker}│ │ │ │ ├─{gdbus}│ │ │ │ └─{gmain}│ │ │ ├─2*[upstart-dbus-br]│ │ │ ├─upstart-file-br│ │ │ ├─upstart-udev-br│ │ │ ├─window-stack-br│ │ │ ├─zeitgeist-datah─┬─{gdbus}│ │ │ │ ├─{gmain}│ │ │ │ └─4*[{pool}]│ │ │ └─zeitgeist-fts─┬─{gdbus}│ │ │ └─{gmain}│ │ ├─{gdbus}│ │ └─{gmain}│ ├─{gdbus}│ └─{gmain}├─nmbd├─plymouth├─plymouthd├─polkitd─┬─{gdbus}│ └─{gmain}├─rsyslogd─┬─{in:imklog}│ ├─{in:imuxsock}│ └─{rs:main Q:Reg}├─rtkit-daemon───2*[{rtkit-daemon}]├─smbd───4*[smbd]├─snapd───9*[{snapd}]├─sshd├─systemd───(sd-pam)├─systemd-journal├─systemd-logind├─systemd-timesyn───{sd-resolve}├─systemd-udevd├─thermald───{thermald}├─udisksd─┬─{cleanup}│ ├─{gdbus}│ ├─{gmain}│ └─{probing-thread}├─upowerd─┬─{gdbus}│ └─{gmain}├─vsftpd├─whoopsie─┬─{gdbus}│ └─{gmain}├─wpa_supplicant└─xinetd/***************************************************pmap*************************************************/
pmap 命令用來顯示指定程序的內(nèi)存信息
pmap [pid] [/proc/pid] /proc是個(gè)非常值得研究的文件夾
例如:
andrew@andrew-Thurley:~/work$ ps -aPID TTY TIME CMD9601 pts/5 00:00:00 grep
15237 pts/20 00:00:00 tload
15587 pts/19 00:00:00 ps
andrew@andrew-Thurley:~/work$ pmap 9601
9601: grep --color=auto .trash
000055a75b948000 200K r-x-- grep
000055a75bb7a000 4K r---- grep
000055a75bb7b000 4K rw--- grep
000055a75bb7c000 4K rw--- [ anon ]
000055a75d889000 132K rw--- [ anon ]
00007f9e0c535000 9980K r---- locale-archive
00007f9e0cef4000 96K r-x-- libpthread-2.23.so
00007f9e0cf0c000 2044K ----- libpthread-2.23.so
00007f9e0d10b000 4K r---- libpthread-2.23.so
00007f9e0d10c000 4K rw--- libpthread-2.23.so
00007f9e0d10d000 16K rw--- [ anon ]
00007f9e0d111000 1792K r-x-- libc-2.23.so
00007f9e0d2d1000 2048K ----- libc-2.23.so
00007f9e0d4d1000 16K r---- libc-2.23.so
00007f9e0d4d5000 8K rw--- libc-2.23.so
00007f9e0d4d7000 16K rw--- [ anon ]
00007f9e0d4db000 12K r-x-- libdl-2.23.so
00007f9e0d4de000 2044K ----- libdl-2.23.so
00007f9e0d6dd000 4K r---- libdl-2.23.so
00007f9e0d6de000 4K rw--- libdl-2.23.so
00007f9e0d6df000 440K r-x-- libpcre.so.3.13.2
00007f9e0d74d000 2048K ----- libpcre.so.3.13.2
00007f9e0d94d000 4K r---- libpcre.so.3.13.2
00007f9e0d94e000 4K rw--- libpcre.so.3.13.2
00007f9e0d94f000 152K r-x-- ld-2.23.so
00007f9e0db52000 20K rw--- [ anon ]
00007f9e0db68000 20K r---- grep.mo
00007f9e0db6d000 28K r--s- gconv-modules.cache
00007f9e0db74000 4K r---- ld-2.23.so
00007f9e0db75000 4K rw--- ld-2.23.so
00007f9e0db76000 4K rw--- [ anon ]
00007ffdaf950000 132K rw--- [ stack ]
00007ffdaf9a4000 12K r---- [ anon ]
00007ffdaf9a7000 8K r-x-- [ anon ]
ffffffffff600000 4K r-x-- [ anon ]/***************************************************tload*************************************************/
tload 顯示系統(tǒng)負(fù)載-d 刷新的時(shí)間以秒為單位-s 指定垂直防線刻度,刻度越小,垂直方向高度越大tty 指定顯示終端-V 顯示版本信息具體效果見圖tload/***************************************************yes*************************************************/
yes 沒聽錯(cuò)就是神器yes
當(dāng)在.bashrc中將rm 定義為別名 rm -i 之后就會遇到批量刪除文件的時(shí)候老是得手動輸入yes確認(rèn)
yes命令和自動回答這個(gè)問題
yes string 會一直輸出string 直到被中斷,若是yes后面不加string 就默認(rèn)輸出 y
示例:
:~/work/test$ touch 1.c 2.c 3.c 4.c
:~/work/test$ yes | rm -i *.c
rm:是否刪除普通空文件 '1.c'? rm:是否刪除普通空文件 '2.c'? rm:是否刪除普通空文件 '3.c'? rm:是否刪除普通空文件 '4.c'? andrew@andrew-Thurley:~/work/test$
:~/work/test$ ls
:~/work/test$ /***************************************************end*************************************************/
?
與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的.bashrc和.vimrc以及一些比较有用的linux命令的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: system函数-linux
- 下一篇: wireshark抓包详解