Linux (ii) _ basic operations and basic linux operations

Source: Internet
Author: User

Linux (ii) _ basic operations and basic linux operations

LinuxFile directory under

The linux File System adopts a hierarchical tree directory structure, in which the top layer

Is the root directory "/", and then create other directories under this directory

It is very important to have a deep understanding of linux file directories.

 

The important directories in the linux root directory are automatically allocated by the system as follows:

Root directory, home Directory, bin directory, sbin directory, mnt directory, etc directory, var directory, boot directory, usr directory, and tmp directory (all directories of the same level)

Root directory: directory used to store files related to the root user

Home Directory: directory used to store related files of common users

Bin directory: directory used to store Common commands

Sbin Directory: used to store the directories of commands that require certain permissions.

Mnt Directory: used to mount the default directory of the drive and optical drive

Etc directory: directory used to store configuration-Related Files

Var Directory: directory used to store frequently-changing files

Boot Directory: directory used to store system boot files (important)

Usr Directory: used to store the default directory for installation (the installation file will be installed in the usr directory by default)

Tmp directory: directory used to store temporary files

 

Character interface operation Basics

1. How to Use the character Interface

2. Local logon and remote Logon

3. Learn to use putty

4. Understand the system running Level and Its Switching Method

5. Master common system shutdown and restart commands

 

Why use the character work style?

1. In character operations, you can efficiently complete all tasks, especially system management tasks.

2. system management tasks are usually performed remotely. Entering the character working mode after remote logon can improve the running efficiency and reduce the bandwidth usage.

3. Because the character interface does not need to start the graphic working environment, this can greatly save system resource overhead.

 

How to enter the character Working Mode

1. Open the terminal window directly in the graphic environment. The shortcut key for switching graphics to the character interface Ctrl + Alt + F2, and the character to the graphic interface Ctrl + Alt + F1

2. After the system is started, enter the character page.

3. Use remote login SSH to enter the character work environment

 

Local logon and logout 
Login: Enter the user name (such as root) and password (pwd) on the logon terminal. Log out: You can enter the logout command on the current logon terminal.

Remote login using putty

Enter ifconfig to view the IP address (remember to enable the wired switch in the graphic interface)

Enter the IP address, open it, and then enter the user name and password to log on.

We can save the current session configuration

We save a session and name it CentOS to bind it to the specified IP address. You can click CentOS next time to create a link.

 

System running level

The modification method of centos7 has changed. The record is as follows:

1. view the/etc/inittab File

2. The file description shows that centos has only two startup modes:

multi-user.target: analogous to runlevel 3# Command Line Mode

graphical.target: analogous to runlevel 5# Graphic mode

3. Run the systemctl get-default command to obtain the current mode:

 

4. Run the systemctl set-default multi-user.target command to modify the Startup Mode:

5. reboot verification results

 

LinuxUser Management (not available to common Users)

Useradd command: useradd username (Add User)

Passwd command: passwd User Name (Change User Password)

Userdel command: userdel User Name (delete user)

Userdel-r user name (delete user and user main directory)

 

Linux centos restart command:

  • 1. reboot
  • 2. shutdown-r now restarts immediately (used by the root user)
  • 3. shutdown-r restarts automatically after 10 minutes (used by root users)
  • 4. shutdown-r restart at (for root users)

If you use the shutdown command to set the restart, you can use the shutdown-c command to cancel the restart.

Linux centos shutdown command:

  • 1. Shut down halt immediately
  • 2. Power off immediately
  • 3. shutdown-h now shut down immediately (used by the root user)
  • 4. shutdown-h: shutdown automatically 10 minutes later

If you use the shutdown command to set shutdown, you can use the shutdown-c command to cancel the restart.

 

Basic command operation:

Ctrl + l clear screen

# Cd .. the upper-level directory cd.../is returned.

# Cd absolute path

# Cd/return the root directory

# Cd file: enter a file

# Ls view files in the directory (Available *? [Abc] wildcard matching)

# Ls-a Show Hidden Files

# Ls-l display details

Command combination ls-al parameter combination

# Pwd display the current directory name

# Mkdir dir1 create the 'dir1' directory

# Mkdir dir1 dir2 create two directories at the same time

# Mkdir-p/tmp/dir1/dir2 create a directory tree

# Rmdir dir delete a specified directory

 

FILE command:

# File: displays the type of the specified file

# Touch file

# Cp file1 file2 copy a file

# Cp-r dir1 dir2 recursive COPY Command (copy sub-directory information)

 

# Rm fileName delete an object

Rm-r dir directory deletion prompt

Rm-rf dir [delete all contents (including directories and files) r recursive f forced]

# Rmdir dir can only delete empty directories

# Mv filename/home Mobile file (folder)

Get Command help: Command -- help, man, or ifo

 

Command completion (prompt matching command)

For example, mk finds all the matches by pressing the Tab, then enters the unique match, and then press the Tab to automatically complete the match.

 

History commands:

!! That is, execute the last command ,! Touh will find the touch command that was last executed, and the last touch command will be executed first .! 50 directly enter the line number of the command history to execute the command.

 

Standard Input and Output:

 

System redirection:

Redirection does not use the system's standard input/output and error output ports, but is re-specified. Therefore, redirection is divided into input/output and error redirection,

Usually redirects to a file.

Input redirection: cat <test1> test2 outputs the file content in test1 to the test2 file.

> The output file will overwrite,> not overwrite, and append

 

MPs queue:

It is actually a combination of commands.

 

 

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.