Linux Basics: 6, Basic command Introduction (1), shortcut key operation

Source: Internet
Author: User
Tags clear screen syslog

Summary of the first five sections

In the previous section, we learned about some of the basics of Linux systems, including Linux system installation, network configuration, Putty remote connections and Yum sources, as well as a brief description of what you need to know, including: Linux history, Linux system startup processes, and more.

Content has been kept short and clear, because there are a large number of high-quality network of documents waiting for your discovery, in addition, if you have the environment, then please try to ensure that they practice, more practice, more information, more summary, and the process of recording down, then is a learning shortcut.



ls "List"

Role: Listing Directory contents

Syntax: LS [options]

Options:

"-L" , Use a long listing format , display with long format

" -a" , display the file name to "." hidden files at the beginning

"-H" , to Human easy-to-read format display, mainly to look at capacity when used "KB" "MB" "GB"

"-I." , showing Inode number

"-R" , reverse -t -tr -t The display order is reversed.

"-T" to categorize the files in the modified chronological order.

"-D" , listing the information in the directory itself, not the contents inside the directory.

===================================================================[[email protected] ~]#  lsanaconda-ks.cfg  install.log  install.log.syslog# "-L" long format display [[email protected] ~ ]# LS -LTOTAL 20-RW-------.  1 root root  967 Feb 13  05:17 anaconda-ks.cfg-rw-r--r--.  1 root root 8749 Feb 13 05:17  Install.log-rw-r--r--.  1 root root 3161 Feb 13 05:15  install.log.syslog# "-H" needs to be combined with "-l" to be effective [[email protected] ~]# ls -hltotal  20K-RW-------.  1 root root  967 Feb 13 05:17  Anaconda-ks.cfg-rw-r--r--.  1 root root 8.6K Feb 13 05:17  Install.log-rw-r--r--.  1 root root 3.1K Feb 13 05:15  install.log.syslog# "-a" displays all contents [[Email protected] ~]# ls -altotal 56dr-xr-x---.   3 root root 4096 Feb 14 04:42 .        #代表此目录dr-xr-xr-x. 22 root root 4096 feb 17 04:46&nbsp ...       #代表上级目录-RW-------.   1 root root  967 feb  13 05:17 anaconda-ks.cfg ... Omit ... drwx------.   2 root root 4096 feb 14 04:52 .ssh-rw-r--r--.   1 root root  129 dec  4  2004 .tcshrc# "-D"-- directory  View the directory itself data [[email protected] ~]# ls .sshauthorized_keys                  #这是. [[email  file in SSH directory protected] ~]# ls -d .ssh.ssh                             #这是. SSHThe properties of the directory itself ==================================================================== 

CD "Change Directory"

Role: Changing the directory path

Common usage:

"CD", back to the login user home directory;

"CD [Path]", enter the target path;

"CD.", enter the parent directory;

"CD-", go to the last directory, equivalent to the back of Windows.

===================================================================== #command1; Command2, which represents command 1 and command 2 sequential execution [[email Protected] etc]# cd/etc; PWD #pwd命令是用来查看当前路径/etc[[email protected] etc]# CD. ; PWD #/etc's parent directory is//[[email protected]/]# cd-#又回到了/etc directory/etc[[email protected] etc]# cd; PWD #只输入 "CD" will enter the current user's home directory/root=====================================================================

Alias

Role: Command alias

Common usage:

Add alias,alias cmd= "command [options] ..."

     View Alias,alias

===================================================================== View alias[[email protected] ~]#  alias |grep ll      #查询包含 "ll" of Aliasalias ll= ' ls -l -- Color=auto ' [[email protected] ~]# ll             #使用ll和ls  -l --color=auto effect TOTAL 20-RW-------.  1 root root   967 feb 13 05:17 anaconda-ks.cfg-rw-r--r--.  1 root root 8749  feb 13 05:17 install.log-rw-r--r--.  1 root root 3161 feb 13  05:15 INSTALL.LOG.SYSLOG[[EMAIL PROTECTED] ~]# LS -LTOTAL 20-RW-------.  1 root root  967 feb 13 05:17 anaconda-ks.cfg-rw-r--r--.  1  root root 8749 feb 13 05:17 install.log-rw-r--r--.  1 root  Root 3161 feb 13 05:15 install.log.syslog# added alias[[email protected] ~]# alias lll= "ls -l  --color=auto "      #设置alias [[email protected] ~]# alias |  grep lll                     #查看aliasalias  lll= ' Ls -l --color=auto ' [[email protected] ~]#  lll                                  #查看效果total  20-RW-------.  1 root root  967 Feb 13 05:17  Anaconda-ks.cfg-rw-r--r--.  1 root root 8749 Feb 13 05:17  Install.log-rw-r--r--.  1 root root 3161 Feb 13 05:15  install.log.syslog===================================================================== 

#用alias命令增加alias只是临时生效的一种方法, once you exit the current terminal, it will expire. We can use the following method to make it permanent

===================================================================== #退出当前终端重新登录login  as: rootserver  refused our key[email protected] ' s password:last login: wed feb  18 04:29:13 2015 from unknown_c8-3a-35-2d-fc-60.gateway.2wire.net[[email protected]  ~]# lll-bash: lll: command not found          #bash告诉我们没有这个命令 [[email protected] ~]# alias |grep lll        #查看一下alias, sure enough, there's no lll alias. # write to the. BASHRC hidden file in the user's home directory, making alias permanent [[email protected] ~]#  Vi .bashrc****************************************************# .bashrc# user specific  aliases and functionsalias rm= ' rm -i ' alias cp= ' cp -i ' alias mv= ' MV  -i ' alias vi= ' vim ' alias lll= ' Ls -l --color=auto '            #Join LLL's Alias# source global definitionsif [ -f /etc/bashrc ]; then         . /etc/bashrcfi****************************************** [[email protected] ~]# . .bashrc                 #重新加载此配置文件 [[email protected] ~]# llltotal  20-RW-------.  1 root root  967 Feb 13 05:17  Anaconda-ks.cfg-rw-r--r--.  1 root root 8749 Feb 13 05:17  Install.log-rw-r--r--.  1 root root 3161 Feb 13 05:15  Install.log.syslog[[email protected] ~]# alias |grep lllalias lll= ' Ls -l  --color=auto ' ====================================================================

#也可以写到/etc/profile, but this file is global, so for security, write in your own home directory. BASHRC is good.


To view command type commands

which

Function: View the full path of the command object only for external commands

Syntax: which command

====================================================================[[email protected] ~]# which lsalias ls= ' ls-- Color=auto ' #可以查到同名的alias/bin/ls #可以查到ls命令的路径 [[email protected] ~]# which CD #为何不能查看cd命令的 Path, because the CD is a bash internal command Yes/usr/bin/which:no CD in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/ BIN) #上面括号里的路径从何而来呢? [Email protected] ~]# echo $PATH/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin# It turns out to be the command path in the system variable path ====================================================================

Type

Function: View command type and information

Syntax: Type command

====================================================================[[email protected] ~]# type Lsls is aliased to ' ls --color=auto ' [[email protected] ~]# type CDCD is a shell builtin[[email protected] ~]# type Manman is hashed (/usr/bin/man ) #man是什么? Don't worry, look down ====================================================================.

#hashed Hash encryption, which is often said to have been hashed


Mans

Function: Online operation help manual for formatted display

Syntax: Man [chapter number] Command name

=============================================================================[[email protected] ~]#  man ls*****************************************************************ls (1)                               User Commands                             ls (1) name       ls - list directory  Contentssynopsis       ls [option]... [file] ... description       list  information  about   the files  (The current directory by default) .        sort entries alphabetically if none of -cftuvsux nor --sort.       mandatory  arguments to long options are  mandatory  for  short   options       too.       -a,  --all              do not  ignore entries starting with .       -a, -- Almost-all              do not  LIST IMPLIED . AND&NBSP, ....        --author               with -l, print the author of each file:************ #ls的命令帮助, page up and down look at it ============================================================================= 


Shortcut key Actions

CTRL + C Cancel command

CTRL + Z Pause command

CTRL + a cursor to the beginning

Ctrl+e cursor to end of line

Ctrl+u Delete all characters before the cursor

Ctrl+k Delete all characters after cursor

Ctrl+l Clear Screen

Ctrl+d Sign Out = = Exit

Ctrl+s lock Command terminal, press any key will not react

CTRL+Q unlock Command terminal

#貌似我最常用的是Ctrl +c and Ctrl+l

This article is from the "30 Demon People" blog, please make sure to keep this source http://301ren.blog.51cto.com/8887653/1614796

Linux Basics: 6, Basic command Introduction (1), shortcut key operation

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.