這篇文章主要講解了“inux常用命令總結(jié)”,文中的講解內(nèi)容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“inux常用命令總結(jié)”吧!
創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比鎮(zhèn)平網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式鎮(zhèn)平網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋鎮(zhèn)平地區(qū)。費用合理售后完善,十年實體公司更值得信賴。linux文件中存在^M
使用shell命令tr可以實現(xiàn)去除,具體命令如下:
代碼如下:
cat -v yourfile | tr -d "^M" > targetfile
VIM中選定某個單詞
在ESC之后,使用w或者wi或者vwi可以選擇某個單詞
在控制臺中快速移動光標
1.刪除
1.1 ctrl + d 刪除光標所在位置上的字符相當于VIM里x或者dl
1.2 ctrl + h 刪除光標所在位置前的字符相當于VIM里hx或者dh
1.3 ctrl + k 刪除光標后面所有字符相當于VIM里d,shift+$
1.4 ctrl + u 刪除光標前面所有字符相當于VIM里d,shift+^
1.5 ctrl + w 刪除光標前一個單詞相當于VIM里db
1.6 ctrl + y 恢復ctrl+u上次執(zhí)行時刪除的字符
1.7 ctrl + ? 撤消前一次輸入
1.8 alt + r 撤消前一次動作
1.9 alt + d 刪除光標所在位置的后單詞
2.移動
2.1 ctrl + a 將光標移動到命令行開頭相當于VIM里shift+^
2.2 ctrl + e 將光標移動到命令行結(jié)尾處相當于VIM里shift+$
2.3 ctrl + f 光標向后移動一個字符相當于VIM里l
2.4 ctrl + b 光標向前移動一個字符相當于VIM里h
2.5 ctrl + 方向鍵左鍵 光標移動到前一個單詞開頭
2.6 ctrl + 方向鍵右鍵 光標移動到后一個單詞結(jié)尾
2.7 ctrl + x 在上次光標所在字符和當前光標所在字符之間跳轉(zhuǎn)
2.8 在vim中的命令輸入模式中,輸入gg,可以快速跳轉(zhuǎn)到文件開頭
2.9 在vim中的命令輸入模式中,輸入GG,可以快速跳轉(zhuǎn)到文件結(jié)尾
3.0 在vim中返回上一個的編輯的位置,在輸入命令模式使用 ctrl+o
3.1 在vim中返回下一個的編輯的位置,在輸入命令模式使用 ctrl+i
3.統(tǒng)計
3.1 例如在vim中統(tǒng)計某個字符串的數(shù)量,可以使用命令
代碼如下:
:%s/Name//gn
防止被某個文件被刪除
1.使用一個shell命令來防止文件下的文件不能被刪除
sudo chattr +a Downloads cd Downloads rm Ngix.pdf mv: cannot move ‘Ngix.pdf' to ‘/home/gpx/.trash/Ngix.pdf': Operation not permitted sudo rm Ngix.pdf rm: cannot remove ‘Ngix.pdf': Operation not permitted
2.使用alias命令來去除rm
alias rm='rm -i' or alias rm=trash trash() { mv "$@" trash/ } or alias rm='cp $@ ~/backup; rm $@'
數(shù)據(jù)同步命令
#!/bin/sh date -d 'now' > /mnt/hd/data/log/rsync.log index=1 while : do rsync -azvh --compress-level=0 --progress gpx@ip:/mnt/hd/data/PriceAdj_data/ /mnt/hd/data/PriceAdj_data/ >> /mnt/hd/data/log/rsync.log if [ $? -ne 0 ];then sleep 5m else break fi let "index++" if [ $index -eq 5 ];then curl -d "operator=alert&phone=number&msg=rsync-dell-data-Failed" "http://ip:port/sendmessage" echo "rsync data Failed !" >> /mnt/hd/data/log/rsync.log exit 1 fi done date -d 'now' > /mnt/hd/data/log/log_save_dateData.log nohup python /mnt/hd/data/code/load_Today_Data.py >> /mnt/hd/data/log/log_save_dateData.log
linux中去除文件中的重復行
代碼如下:
sort -n Yourfile | uniq > save_path
更新Linux系統(tǒng)時間
代碼如下:
sudo ntpdate cn.pool.ntp.org
亞洲地區(qū)的ntp服務(wù)器
代碼如下:
. Bangladesh — bd.pool.ntp.org . China — cn.pool.ntp.org . Hong Kong — hk.pool.ntp.org . India — in.pool.ntp.org . Indonesia — id.pool.ntp.org . Iran — ir.pool.ntp.org . Israel — il.pool.ntp.org . Japan — jp.pool.ntp.org . Korea — kr.pool.ntp.org . Malaysia — my.pool.ntp.org . Philippines — ph.pool.ntp.org . Singapore — sg.pool.ntp.org . Taiwan — tw.pool.ntp.org . Thailand — th.pool.ntp.org . Turkey — tr.pool.ntp.org . United Arab Emirates — ae.pool.ntp.org
在vim中進行完整單詞的匹配
使用命令行輸入模式
/\<這里輸入你要匹配的單詞\>
如果在單文件中使用進行查找和匹配
直接使用在命令輸入模式下 對某個單詞使用 *
使用scp和rsync進行數(shù)據(jù)的內(nèi)網(wǎng)數(shù)據(jù)傳輸和備份
代碼如下:
rsync -azvh --delete --compress-level=0 --progress username@hostname(ip):file_path save_path >> log_path
參數(shù)解釋:
-v: --verbose increase verbosity --info=FLAGS fine-grained informational verbosity --debug=FLAGS fine-grained debug verbosity --msgs2stderr special output handling for debugging -a: --archive archive mode; equals -rlptgoD (no -H,-A,-X) --no-OPTION turn off an implied OPTION (e.g. --no-D) -z: --compress compress file data during the transfer --compress-level=NUM explicitly set compression level --skip-compress=LIST skip compressing files with suffix in LIST -h: --human-readable output numbers in a human-readable format --progress show progress during transfer --delete delete extraneous files from dest dirs scp mode remote_username@remote_hostname(or ip):remote_file_path dest_file_path >> run_log_path example: name@host:/mnt/hd/data/code/shell$ scp sql_rsync.sh name@host:/tmp/ name@host's password: sql_rsync.sh 100% 149 0.2KB/s 00:00 name@host:/mnt/hd/data/code/shell$接下來給大家總結(jié)了10條linux常用命令
1.》將原文件清空,并且內(nèi)容寫入到文件中,》》將內(nèi)容放到文件的尾部
代碼如下:
echo “aa” 》 test.txt 和 echo “bb” 》》 test.txt
2 給組用戶和其他用戶添加寫的權(quán)限
代碼如下:
chmod go+w -R /home/zhangy
3. 列出歸檔內(nèi)容
代碼如下:
tar -tzvf test.tar.gz
4.查看文件列表大
代碼如下:
du -ah
5. 查看所有文件的大小總和
代碼如下:
du -sh
6.數(shù)學運算
代碼如下:
echo ‘1+2'|bc -l
7. //查看linux內(nèi)核等的一些信息
代碼如下:
uname -a
8.壞道掃描時顯示進度
代碼如下:
badblocks -s /dev/sda
9.查看命令的運行時間
代碼如下:
time command
10.按時間的倒序排序
代碼如下:
ls -lrt
感謝各位的閱讀,以上就是“inux常用命令總結(jié)”的內(nèi)容了,經(jīng)過本文的學習后,相信大家對inux常用命令總結(jié)這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,,小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!
網(wǎng)站欄目:總結(jié)inux常用的命令-創(chuàng)新互聯(lián)
分享地址:http://muchs.cn/article42/psiec.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App設(shè)計、移動網(wǎng)站建設(shè)、網(wǎng)站策劃、營銷型網(wǎng)站建設(shè)、關(guān)鍵詞優(yōu)化、面包屑導航
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)