centos commands

                              common command 

  • find certain folder :     find / -type d -name ‘folderName’
  • find file :   去掉 -type d 
  • copy all files in current folder to another path  :

cp -r /home/server/folder/test/*      /home/server/

if want to copy all files and all subfolders ,  use

cp -R * /home/tom/backup

  • rm *  will delete all files in a folder ,  if files include write-protected ,  use rm -f * 
    • make .sh file executable :        chmod +x filename
    • rename folder or file :        mv hkg.csl-collector1    my.maxis.collector1
    • list all file include some string :      ls somestring*
    • delete folder and all files include subfolder :     sudo rm -r foldername
    • check if centos is 32 or 64 bits : uname -a
    • check file status : stat filename
    • monitor runtime log :  tail -f bridge.log 
    • monitor last 10 lines of log file : tail -n10 bridge.log
    • check folder size :    du -sh /var/Asterisk/asterisk  , this is check one folder size , If want to check every folder size under certain path :   du -sh *
      • check if selinux is opened :  sestatus
      • search certain text in some folder
        grep -r “language_attributes” /var/www/html/wordpress/*

  •       search certain text in all the folders and their sub fold :
  •             grep  wordToSearch  * -R 
    • copy all files in one folder to another folder :

  cp -r /var/modules/tinyRadiusServer/*      /var/modules/tinyRadiusClient

  • 把某目录加入到系统路径



  • show folder structure as tree


  • list top 10 size fold of a special folder :

  • compress and decompress

uncompress   tar xvzf XXXX.tar.gz 

from   https://www.interserver.net/tips/kb/extract-tar-gz-files-using-linux-command-line/

tar -xjf test.tbz


For compress :


  • -z : Compress archive using gzip program
  • -c : Create archive
  • -v : Verbose i.e display progress while creating archive
  • -f : Archive File name
  • chown

  • Firewall

centos7 open http 8080 port :



  • add user


  • 权限

drwxrwxr-x     :  chmod 775

-rw-rw-r–         :  chmod    664

数字和字母的转换关系 :



  • 看centos 版本

  • 32还是 64位

  • 把某文件夹所有文件打包成zip



                            nano command 

  • select all

To select text in nano, move the cursor to the start of the text you want to select, press the Alt-A key combination to mark the start, then move the cursor to the end of the section you want to select. press Ctrl+K to cut your selection and Ctrl+U to paste it.

  • 复制粘贴

ctrl +6 设置起始点

选中要copy的部分之后, alt+6

然后到要粘贴的位置  ctrl + u


修改 /etc/supervisord.conf 以后, 需要执行







work together with ctags 

use asterisk project as example :

goto folder :  /usr/src/asterisk-certified-13.18-cert3

run  : ctags -R  will  generate a  file named: tags

then for example  :

cd main

vim asterisk.c

set tags=/usr/src/asterisk-certified-13.18-cert3/tags

after doing that ,  vim already know where to find tags




可以在 vimrc 添加以下命令


then when stay cursor in some constant or function name and press :

CTRL +  ]

vim will  guide u  into where this tag define

CTRL + t  will go back to previous file

quit split window :

more ctags skills

vim 复制 剪切 删除 copy

  • VIM serach 

To find a word in Vi/Vim, simply type the / or ? key, followed by the word you’researching for. Once found, you can press the n key to go directly to the next occurrence of the word.



show file name  :

quit without saving

  • vim中使用cscope

cscope比ctags 好,更容易找到 函数定义之类




Centos 7  command 

  • 看 service 状态