Mylinux Note---3rd day

Source: Internet
Author: User
Tags aliases clear screen

First, LS: Displays the contents of the current file and directory

Format: LS-[option] [directory name]

-A show all hidden files

-L (long format) display file details

-I display index node information for each file

-T sorted by time

-G displays all content except group information in the directory

-L Export the symbolic link file as a normal file

-d lists the directory itself instead of the files in the directory when the directory is encountered

-C mate-lt: Sorts and displays ctime based on CTime (the last time the file state was changed)
Mate-L: Show CTime but sort by name



Second, the default directory structure of Linux

/File system root directory (/), with multiple subdirectories under the root directory

[[email protected]/]# Lsbin Dev etc lib media opt root selinux sys usrboot DVD home Lost+found mnt Proc Sbin SRV tmp var[[email protected]/]#

/boot directories that store the Linux kernel and boot add-ons. The kernel is a vmlinuz-* file

/etc The directory where the operating system environment settings files are stored, mostly text files

/ETC/PASSWD: Files that hold individual user information

/etc/shadow: Save files Saved by user encryption

/etc/fstab: Save files for device tables that need to be mounted automatically when the system starts

/etc/hosts: Save the network host name and IP address of the file

/ETC/RC.D/INIT.D or/ETC/INIT.D: A directory to save the various system service scripts that are required at startup

/etc/resolv.conf: Save the file of the designated name server when the system is logged on externally

/ETC/SYSCONFIG/I18N: Save set language set at startup (lang= "ZH_CN. UTF-8 ") variable

/etc/sysconfig/iptables-config: Save files for Linux firewall iptables environment settings

/etc/sysconfig/network: A file that determines whether to support the network and set the managed name at startup

/etc/sysconfig/network-scripts/ifcfg-eth0: The first Ethernet information file to be used when you start a save

/bin,/usr/bin Save executable program Directory

/bin directory to store default executable program

The/usr/bin directory holds the executable program that the user wants to use

/sbin,/usr/sbin Storage System administrator-specific programs, most of which only super users can execute

/lib Storing shared library files

/var store various log files that detect system changes during execution

/home personal directory with different user master directories

/root Store Superuser's home directory

/dev Store device files for Linux systems

/media,/mnt This directory is a mount point and is a directory that mounts a variety of physical storage devices, which are attached to the process for use.

/srv data required for the service process

/OPT is a directory for some large software or some special software
/tmp directory where temporary files are stored
/usr stores a variety of files supporting user applications, similar to the Win Programs Files folder
/proc Virtual File system

For example: Bring up the CPU, memory information

[[email protected] ~]# cat/proc/cpuinfo <== call up CPU information [[email protected] ~]# Cat/proc/meminfo <== recall Memory information


Expand your knowledge

Pstree: Tree-shaped process

[[Email protected] ~]# pstreeinit─┬─auditd───{auditd}     ├─crond      ├─dbus-daemon     ├─dnsmasq      ├─hald─┬─hald-runner─┬─hald-addon-acpi     │       │             └─hald-addon-inpu      │      └─{hald}      ├─libvirtd───10*[{libvirtd}]     ├─master─┬─pickup     │         └─qmgr     ├─6*[mingetty]      ├─rpc.statd     ├─rpcbind      ├─rsyslogd───3*[{rsyslogd}]     ├─sshd───sshd───bash───bash───pstree      └─udevd───2*[udevd][[email protected] ~]# 

Tree: Table of Contents

Option:-C to differentiate file types by color

-L View the depth of the directory

[[email protected] ~]# tree -cl 2 /boot/boot├──  config-2.6.32-504.8.1.el6.i686├── config-2.6.32-504.el6.i686├── efi│   └──  efi├── grub│   ├── device.map│   ├── e2fs_stage1_5│    ├── fat_stage1_5│   ├── ffs_stage1_5│   ├── grub.conf│    ├── iso9660_stage1_5│   ├── jfs_stage1_5│   ├──  menu.lst -> ./grub.conf│   ├── minix_stage1_5│   ├──  reiserfs_stage1_5│   ├── splash.xpm.gz│   ├── stage1│    ├── stage2│   ├── ufs2_stage1_5│   ├── vstafs_stage1_ 5│   └── xfs_stage1_5├── initramfs-2.6.32-504.8.1.el6.i686.img├──  Initramfs-2.6.32-504.el6.i686.img├── lost+found├── symvers-2.6.32-504.8.1.el6.i686.gz├── symvers-2.6.32-504.el6.i686.gz├── system.map-2.6.32-504.8.1.el6.i686├──  system.map-2.6.32-504.el6.i686├── vmlinuz-2.6.32-504.8.1.el6.i686└── vmlinuz-2.6.32-504.el6.i6864  directories, 26 files[[email protected] ~]#



Third, CD: Switch working directory

Format: CD [directory path name]

The directory pathname is written in two ways: the absolute path, the path from the root (/) to the directory to be toggled, and the relative path, whichever is the current working directory, relative to the current directory path name

① Absolute Path

[[email protected] ~]# cd/etc/sysconfig/<== start with the first level of writing [[email protected] sysconfig]#

② relative path

[[Email protected] etc]# CD sysconfig/<== current directory is the first level in the path, then write the path [[email protected] sysconfig]#

③ returns the last directory in which it was located

Command: CD-

[[email protected] sysconfig]# pwd <== View the full path of the current directory/etc/sysconfig[[email protected] sysconfig]# cd/tmp <== Enter Another directory under directory [[email protected] tmp]# Pwd/tmp[[email protected] tmp]# CD-<== return to the previous directory/etc/sysconfig[[email protected ] sysconfig]# pwd <== return success/etc/sysconfig[[email protected] sysconfig]#

④ Return home Directory

Cd

[[Email protected] sysconfig]# CD [[email protected] ~]# Pwd/root[[email protected] ~]#

Or

cd~

[[Email protected] sysconfig]# CD ~[[email protected] ~]# Pwd/root[[email protected] ~]#

⑤ return to the top level directory

Cd..

[Email protected] sysconfig]# pwd/etc/sysconfig [[email protected] sysconfig]# CD. [Email protected] etc]# Pwd/etc[[email protected] etc]#




Alias is a user-defined form of instruction abbreviation

Usage of aliases

①alias View all aliases set in the current shell, that is, the alias directory

[Email protected] ~]# aliasalias cp= ' cp-i ' Alias l.= ' ls-d. *--color=auto ' Alias ll= ' Ls-l--color=auto ' Alias ls= ' ls--co Lor=auto ' Alias mv= ' mv-i ' Alias rm= ' rm-i ' Alias Which= ' Alias | /usr/bin/which--tty-only--read-alias--show-dot--show-tilde ' [[email protected] ~]#

② Creating aliases

Alia [alias name]=[command to execute]

[[email protected] ~]# alias C=cd[[email protected] ~]# C/[[email protected]/]# lsaaa bin boot Cgroup Dev etc home Lib Lost+found mbr media mnt opt proc root sbin selinux SRV sys tmp usr var[[email protected]/]#

③ Deleting aliases

Unalias [aliases]

[[email protected] ~]# unalias c[[email protected] ~]# C/-bash:c: Command not found[[email protected] ~]#

The ④ child shell does not inherit the alias set in the parent shell command line, and when a new shell is opened, the alias is reset, so it needs to be permanently set up by:

[[email protected] ~]# vim. BASHRC <== Edit. bashrc file, add alias to set

For example: Add alias c=cd that you just set, exit save

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/5B/3D/wKioL1UC-RvzExBTAAD-IrOoklY973.jpg "title=" Bashrc.jpg "alt=" Wkiol1uc-rvzexbtaad-irookly973.jpg "/>




Four. Use of the environment variable path

Path is used to retrieve the command's retrieval path.
①echo $PATH can view the value of the system's environment variable path and use the which command to see the absolute path of a command

[Email protected] ~]# echo $PATH/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin[[email Protected] ~]#

②path= $PATH:/tmp so that we can use the executable file/tmp/as a command

[Email protected] ~]# path= $PATH:/tmp

③ let path take effect permanently, need to add it to/etc/profile or. Bash_profile, reboot takes effect, or Run command directly: Source/etc/profile


Five. Shortcut keys
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






This article is from the "Mylinux" blog, make sure to keep this source http://mylinuxlife.blog.51cto.com/4706737/1620254

Mylinux Note---3rd day

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.