Linux Common commands

Source: Internet
Author: User

switching machine, restart, logoff shutdown-h now #立即关机reboot #重启exit #注销当前用户上传下载文件, these two commands need to be installed, not brought to the command #yum-y install Lrzsz#rz and sz can only manipulate files, cannot manipulate folder RZ #上传sz filename #下载文件添加, delete user, switch user useradd myuser #添加用户userdel myuser #删除用户su 
    -User #切换用户sudo reboot #普通用户获取root用户权限, add sudo to the command before the WHO #查看当前已经登录的用户whoami #查看当前用户查看ip地址, System Information IP a #看ip地址ifconfig #看ip地址, some systems do not have ifconfig commands uname-a #看当前系统是位数和内核信息vi编辑器 vi file #编辑file这个文件, the specific inside of the operation to see http://www.nnzhp.cn:80/archives/484common command ls #查看某个目录下内容 ls/tmp #显示/The contents of the tmp directory, if not followed by the path, displays the contents of the current directory LS-l #详细信息显示 LS-a #显示所有文件, including hidden files ls-la #详细模式显示所有文件ll equals ls-LCD #进入某个目录 CD/tmp CD: #返回上一级目录 CD ./.. /#返回上两级目录cp #复制, use all the time.-RF parameters, everything can replicate CP-RF a.txt/tmpmv #移动文件, also have the role of renaming, #改名和移动区别是, if the following is a file name, then it is renamed, if the following is a path, then move MV A.txt/tmp #移动a. txt to/tmp directory MV b.txt my.txt #把b. txt is changed to MY.TXTRM #删除文件, folder, can not be restored after deletion, with the use of adding-the RF parameter will erase the RM-rf a.txtpwd #显示当前绝对路径mkdir mkdir dir #创建文件夹cat View the contents of the file Cat A.txtmore view the contents of the file, the contents of the file more than the time, CTRL+C exit More a.txtless split screen to view the contents of the file, the file content when used, enter Q exit less a.logtail from the end of the file to view the contents of the file, generally add-f parameter, can be viewed dynamically, exit tail,ctrl+C Exit Tail-F a.log Tail-50f a.log #从末尾第50行开始看touch Create an empty file, if the file exists, then the modified log of the file will be updated touch a.txtdu file occupancy size du-sh *#查看当前目录下所有文件占用的空间 du-sh/tmp #查看tmp目录下占用的大小df View Current disk footprint DF-lhchmod to File/folder Modify permissions chmod plus permissions in two ways, digital way and text mode R: Read, number is 4 W: Write, Number is 2 x: Execute, Number is 1 chmod777A.SH #7=4+2+1 is a readable writable executable permission, the number is to add up the text mode chmod+x a.sh #加上执行权限 chmod+WRX a.sh #加上可读可写可执行的权限, that is, and 7,771 like why there are 3 7, the first representative of the file belongs to the user's permissions, the second representative of the user's rights in this group, the third representative of the rights of other users of the text mode to assign permissions, you have to specify exactly which group U--owner G--same group O--a person other than others;--All+ --Increase Permissions- --Remove Permissions-R recursion, mainly used in a directory, to put this directory under all the files/folder Assignment Permissions chmod-R A +x ABC #为文件abc及其子目录底下的所有文件的全体用户增加x权限 chmod u-x ABC #为abc文件的用户拥有者去除x权限grep Find file contents grep'besttest'a.txt #从a. txt besttest grep-V'besttest'a.txt #排除besttestps View process PS has a lot of parameters, the specific parameters can be seen http://Man.linuxde.net/psgenerally used PS to see if a process starts PS-ef|grep Java #ps-ef Find all the processes and look for Java from all the processes, "|" is a pipe character, which can be understood as the PS-The result of the EF command is passed to grep through this pipeline, and then grep is searched from inside. PS-ef|grep mysql #查询mysql相关进程 By default there will be an extra process, which is grep itself, meaning that PS-ef|grep xx, at least there will be a process, if you say ps-ef|grep query process only one time, it means that you want to query the process does not exist PS-ef|grep Httpd|grep-v grep #这一条命令就是3个连着用了, after finding httpd, and then the grep itself to exclude the kill to stop the process, that is, Windows forced to shut him down kill-9PID #杀掉这个这个进程, PID can be used PS-EF Checks the resource usage of top dynamic monitoring Server, CTRL+C Exit Find file find/-name a.txt #第一个参数是路径,-name is queried according to the file name, this is from the root directory to find the name a.txt file tar used to package, unpack the tar czvf my.tgz my #把my这个文件夹压缩并打包成为my. tgz tar cvf my.tar my # Package my This folder into My.tar, do not add Z This parameter is just packaged, not compressed tar czvf my.tar.gz my #把my这个文件夹压缩并打包为my. tar.gz, suffix both, you can use tgz and tar.gz to tar xvf m Y.tgz #解包, only need this kind of posture when untie, can untie #tar解包的时候可以截后缀为. tgz. tar.gz. Tar these three kinds of gzip, ungzip are used to package, decompress. GZ End Compressed Package ungzip a.gz #解压 g Zip A.txt #压缩, after compressing the original file will not zip, Unzip zip packet http://Man.linuxde.net/ziphttp//Man.linuxde.net/unzipYum installs the software yum is a fool-like installation software, what you want to pack, yum What to do, Red Hat system only yum, Ubuntu and Debian is not the Yum-y Install nginx# installation nginxrpm is also installed software, if a package name is the end of. RPM, then use RPM to install the RPM-IVP mysql.rpm http://man.linuxde.net/rpmcrontab timed Task crontab-e Add crontab task http://Man.linuxde.net/crontab Look at the following exampleExecute shell script If a file ends in. SH is a shell script execution, the front plus SH will be able to use SH start.sh1. ll2. LS3. PWD4. CD5. MV6. RM7. Vim i/n next? Look up n Next: Wq command line x delete u recall dd Delete Row U recall shift+g last line: N Go to the first few lines:SetNu8. chmod777CHOMD a+/-u+/-g+/-o+/-XRW142folder permissions chmod-R recursion9. mkdirTen. CP-RF Replication One. Touch to create a new file A. Alias Customization -. Tail-10f xxx Dynamic Find -. Cat cannot split the screen to view small files the. More can split the screen, but can only look down -. Less view support for commands in Vim -. Kill -. IP a View IP address

Linux Common commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.