Learn Linux Journeys--day three--

Source: Internet
Author: User
Tags aliases clear screen windows dll files

March 13, 2015 20:00:55

I. Introduction and usage of Ls,cd,alias command

II. directory Structure

Third, the common shortcut keys for Linux


First, take a look at the LS command

LS (optional) (parameter): Used to display the target list, in Linux is the most used command, the LS command output information can be colored highlighting, to distinguish between different types of files.

-A: Displays all files H or directories (including hidden files, ".", "..")

-L: Show details in long format

-D: View the current directory itself, does not list files or directories under the directory

-I: Displays the index node number (inode) of the file

-T: Display in File change time order

Common parameters are not many, if necessary, check the Help document


CD: Commands for switching the working directory

CD entry to the current user's home directory

CD ~ Enter the user's current home directory

CD-Enter the last entered directory

Cd.. Go to the top level directory

Cd.. /.. Go to the top level two directory


Alias: Used to set the alias of the directive, simplifying some of the longer commands

1. You can use the alias command directly to see which aliases are set

2. Format aliases: alias command aliases = ' Source command-options/Parameters '

3. Delete an alias and use the Unalias command

4, make the alias permanent, need to set the alias command, add to ~/.BASHRC


Ii.directory Structure of Linux ( reference material )

/bin:bin is the binary (binary) abbreviation, which is the most commonly used command in this directory.

/boot: This directory contains some of the core files that are used when starting Linux , including some connection files and image files.

/dev:dev is a device abbreviation that stores the external devices of Linux and accesses the device in Linux in the same way that it accesses the file.

/etc: This directory holds all the required configuration files and subdirectories for all system management.

   / Home: This is User's home directory , in Linux, each user has a directory of their own, usually the directory is named after the user's account, useradd This directory will have a user's home directory when adding users

/lib: This directory is the most basic system of dynamic connection shared library , similar to the Windows DLL files , almost all applications need to use these shared libraries, LDD command to view the Lib file (ldd/bin/ls) for a command

/lost+found: This directory is generally empty, and when the system shuts down illegally, some files are stored here.

/media: The system will automatically identify some devices (such as a USB flash drive, CD-ROM, etc.), then Linux will attach the identified device to this directory.

/MNT: The system provides users with temporary mount directory , you can hang the optical drive to this directory, and then enter the directory to view the contents of the optical drive

/OPT: This is the directory that is set up to install additional software for the host, which is empty by default, such as you need to install an Oracle database that can be placed in this directory.

/proc: This directory is a virtual directory, is a mapping of system memory , we can obtain the system information through direct access. The contents of this directory in memory, we can directly modify some of the files inside. For example, you can use the following command to block the ping command of the host, other people cannot ping your machine.

# echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all

/root:The home directory of the root account .

/sbin:s is the meaning of super user, which holds the system Administrator or command used by the system administrators .

/selinux:selinux It is a security mechanism, similar to the firewall of Windows, but this mechanism is more complex, which holds files related to SeLinux .

/srv: This directory holds data that needs to be extracted after some services have been started .

/sys: This directory holds information related to hardware drivers.

/tmp: This directory holds some temporary files.

/usr: A very important directory, similar to the program file folder under Windows, where many of the users ' applications and files are stored in this directory .

/usr/bin: This directory holds applications that are used by system users .

/usr/sbin: This directory holds the more advanced hypervisor and system daemon used by super users .

/USR/SRC: This directory holds the default drop directory for the kernel source code .

/var: the directory is stored in a directory that is constantly expanding and is frequently modified , including various log files.

Summary of the above important directory, can not mistakenly delete or arbitrarily modify its internal documents:

/etc: is a system configuration file that may cause the system to fail to boot properly.

/bin,/sbin,/usr/bin,/usr/sbin: Is the system preset execution file placement directory, where/bin,/usr/bin directory is for system users to use the instructions (in addition to root users), and/sbin,/usr/ The Sbin directory is a command that provides root usage.

/var: the log generated by all programs running on the system is recorded in that directory (i.e. the/var/log directory), and the default of the mail instruction is placed here.


Third, Linux common 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


Four, in the end need to add a bit of knowledge, environment variable path:

Environment variables are strings that contain information about the environment of the system and the currently logged-on user, and the shell initializes different environments for different users when it is started, and when the shell is called, it reads commands from both initial files. The/etc/profile contains system variables, which are maintained by the system administrator, and are set by system administrators for local system variables and special commands. The Startup information file ($HOME/.bash_project) of the ordinary user is maintained by the individual user, and the file can be modified to implement any specific system initialization:

environment variable configuration file for the system:

/etc/profile: Can modify path, USER, LOGNAME, mail, etc.

/ETC/BASHRC: Can modify PS1, umask, etc.

User environment variable configuration file (user's home directory):

. Bash_profile: User's own environment variables

. BASHRC: The file that the user logged in or the newly opened shell will execute, source. BASHRC can take effect directly on this configuration

. bash_hostory: A file that records the history command, only the normal exit shell will write to this file

History-c Clear History Command

History-w writing a History command of memory to a configuration file

. Bash_logout: When exiting the shell is the execution of the configuration file



The common environment variables in Linux are:


1.PATH: Specify the search path for the command

2.HOME: Specify the user's main working directory (that is, the default directory when the user logs on to the Linux system)

3.HISTSIZE: Refers to the number of records saved by the history command.

4.LOGNAME: Refers to the login name of the current user.

5.HOSTNAME: Refers to the name of the host, and many applications are usually obtained from this environment variable if they want to use the hostname.

6.SHELL: What kind of SHELL is used by the current user.

7.lang/languge: and language-related environment variables, users in multiple languages can modify this environment variable.

8.MAIL: Refers to the current user's mail storage directory.

9.PS1: Command basic prompt, for root user is #, for normal user is $.

10.PS2: Wait for the prompt, default is ">", such as SEQ \, you will see the waiting prompt


I personally like this: ps1= "\[\e[32;1m\][\[email protected]\h \w]$>\[\e[0m\]"

For more information about PS1 settings, please visit


Of course, the above environment variables I have listed are not exhaustive!

Linux also provides commands to modify and view environment variables!

1.echo displays an environment variable value echo $PATH
2.export setting a new environment variable export hello= "HELLO" (can be without quotation marks)
3.ENV Show All environment variables
4.set show locally defined shell variables
5.unset Clear environment variable unset HELLO
6.readonly set read-only environment variable readonly HELLO




This article is from "Xiao Xu" blog, please be sure to keep this source http://loopholes.blog.51cto.com/9445813/1620631

Learn Linux Journeys--day three--

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.