Linux Command Line notes (1)

Source: Internet
Author: User

Yunduan CUI

Graphical user interfaces make easy tasks, while command line interfaces make difficult tasks possible

Part 1 Learn Shell1. What is a Shell?

A shell is a program that the user communicates with the operating system, reading the user's keyboard input and handing the command to the operating system. All Linux supports a shell called Bash, whose full name is "Bourne Again Shell", which was formerly written by Steve Bourne Sh.

When we use the shell, we actually need another program called terminal Emulator to interact with the shell, which is a common program called terminal. (The terminal can choose a different shell)

2. Cruising

Cruise the Linux file system, commonly used commands for:
* ls: Displays the current working directory of the file
* CD: Change working directory
* PWD: Displays the current working directory name

Linux uses a tree-based file system. Unlike Windows, which considers every disk as a standalone file system, Linux always maintains a filesystem.

When using the CD command, the CD returns directly to the default directory, and CD ~user_name returns the default directory for the corresponding user, CD-back to the previous directory. Other than that. Represents the current directory,.. Represents the parent directory

When using the LS command, the default is not to show hidden files, to show them using ls-a

3. Explore the file

For more tips on using LS, LS supports displaying the contents of a specified folder, as well as displaying the contents of two folders. Use Ls-l to display the long format of a file. -T to sort files by change time. Other more useful options:
*-F Special Callout/After folder name-R inverse with alphabet display-S to sort by file size-T to change the time ordering

About long formats for files

Where the first column is the first letter of the file access permission:-Represents a regular file D represents a folder L represents a connection file the next three letters are permissions to the owner of the file, and the next three letters are permissions to the same group of members, and the last three are the rights to everyone. R represents the read W for the second column represents the number of files In the folder, the word of the file is naturally 1) The third column represents the owner of the fourth column that represents the group fifth column that represents the file size (bytes) Sixth column is the creation date Seventh column is the file name

Determine file type

Use the file command to determine the type of files

Read File contents

Use the less command to read the contents of the file, after entering the contents of the operation as follows:
Page up/b roll forward one page
Page down/space and scroll one page
Up/down arrows roll forward/roll back one line
G move to end of file
1g/g move to file header
/"Characters" forward lookup "characters"
N Find Next Find target
H Display Help
Q exit

The predecessor of less was called more, and the reason for this looks the opposite name because

Introducing the file system
Directory name Introduction
/ root directory
/bin Contains Binaries Storage System Program
/boot Information about startup, initialized RAM and hard disk mirroring, and the Linux kernel
/dev Storing drivers
/etc Storage System, program configuration file, and shell script
/home To the user to use the folder, the general user only need to work within this file
/lib All the library files used by the program (a bit like the Windows DLL file) are here
/lost+found The formatted Linux file system will have this folder and can be used to partially recover files. Unless something bad happens, it's usually empty.
/mnt Only on older Linux, which is used to store the drive of a removable device
/opt Optional programs are placed here, which usually contains the program that the user later installs
/proc This is a special folder. It is a virtual folder, the equivalent of a peep hole to the Linux kernel, you can see from the file inside how the kernel looks at the current PC
/root Directory of root Account
/sbin Super user, with core system program included
/tmp Temporary file storage location
/usr Generally, it is the largest folder and contains all the programs and files that regular users use.
/usr/bin Storage of installed Linux executable files
/usr/lib Library files used by user installation files
/usr/local User-installed programs, generally compiled from the source files are installed here
/usr/sbin Store the installed Administrator program
/usr/share Files stored in the/usr/share program
/usr/share/doc Some of the packages that are normally installed contain documents, just put them here.
/var It is also used to store files that are often changed, such as user mail
/var/log Storing log files
Symbolic Links

A unique form of file in Linux that can be connected to other files. Also known as the soft link soft link, he can facilitate us to update the version of some components, because link can be used as a variable name.

4. Operating Files and directories

Linux Command Line notes (1)

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.