Linux Basics (i)

Source: Internet
Author: User
Tags posix

I. Understanding the origins of Unix and Linux1.unix and Linux

After the concept of time-sharing operating system, Bell Labs and GE decided to develop a multics that could support hundreds of terminals while Ctts successfully developed, but failed. Later, a computer scientist Ken Thompson, who attended the development of Multics, developed a simple, single-user version of Multics, which was later a UNIX system. Based on its many other versions of UNIX, in order for the program to run on any version of UNIX, the IEEE proposes a UNIX standard, the POSIX (Portable OS Interface Portable Operating system Interface), Then, in 1987, there was a small clone of Unix, Minix, used for teaching. Finnish student Linus Torvalds wrote Linux based on it.

2. Learn about the GNU program and free software

1) The GNU program was publicly launched by Richard Stallman on September 27, 1983, with the goal of creating a completely free operating system.
2) understand the GPL terms
The GPL clause is to ensure that GNU software is free to use, reproduce, modify and distribute, and that all GNU software has an agreement to grant all rights to any person without limiting any restrictions to others.
3) Understanding free software means:
You have the freedom to run the program for any purpose.
You have the freedom to modify your program to suit your needs.
You have the right to re-issue copies, either in white or at a certain charge.
You have the right to publish the modified version of the program so that others benefit from your improvements.

3.Linux system

Linux is a free-to-use and free-to-propagate Unix-like operating system, a POSIX and Unix-based multiuser, multitasking, multi-threaded and multi-CPU operating system. Mainly used for servers, especially network servers.

Linux endpoints: Linux endpoints are also known as virtual consoles. The Linux terminal uses the character command line method to work, the user through the keyboard input command, through the Linux terminal to control the system.

Commands to shut down Linux systems: Init 0

How to switch virtual Terminal: ctrl+alt+f[1~6], if you want to switch to the second virtual terminal, press CTRL+ALT+F2 at the same time

System prompt for normal user login: $

Root User Login system prompt: #

Exit Command: Exit

Second, Linux installation

1.Linux releases are: CENTOS, RHEL, FEDORA, UBUNTU, SUSE

2. Install the CENTOS7 version

Iii. Linux Basic commands

Syntax format for linux commands: command option Parameters

Command: Tell the Linux (UNIX) operating system what to do (execute).
Options: Describes how the command runs (you can change the function of the command). The options section starts with a "-" character.
Parameters: Describes what the command affects (action) (such as a file, a directory, or a paragraph of text)

1.whoami command

Displays the currently logged on user

2.who command

Show users who are already logged in

3.PWD command

View current Path

4.CD Command: Switch directories

Syntax: CD path

Cd.. Return to previous Catalog

CD-Return to the previous directory

CD ~ Represents the home directory of the current user

CD/Return root directory

5.date, Cal command

Date: Show Dates

Date-s Date Modified

Cal: View Calendar

Cal Date: View calendar for a specified date

6.clear command

Clear the screen command, you can also use the shortcut key ctrl+l

7.su command

Switch user, switch from normal user to root user needs to enter password, switch from root user to normal user without entering password

8.PASSWD command

Change Password

passwd User: Change the password of the specified user (required under root user)

You can also change the password directly with one command: Echo ' new password ' | passwd--stdin User

9.man command

View the Help manual for a command

Here's how to use it:

CTRL + F or PAGE DOWN: pages down

CTRL + B or PAGE up: pages up

GG to First line

GG to the last line

/start: Can search the entire manual for Start-related characters, use N to find the next, use N to find the previous

J,k is used in the same way as VI, J down line, K up line

D Down half page

U Flip Half page

H Get man use Help

Q Exit Man

The help document for viewing commands can also be used: command--help, but not all commands can be used this way.

10. Create a new folder and create a new file

mkdir folder: Create a new folder under the current directory

mkdir Absolute Path folder name: Create a new folder at the specified location

Mkdir-p: To create a directory recursively

Note: If there are spaces in the file name, you need to add an escape character "\" before the space

Touch: Create a new empty file

11. Copying

CP source file path destination path

Cp-r Recursive copy Directory

Cp-a Keep the file details intact while copying

Cp-f do not ask for direct force replication when the target file already exists

12. Move and rename: mv13. Delete

Rm-r Deleting a folder

RM-RF No confirmation information, delete directly

14. viewing files: ls

Ls-a: View all files, including hidden files (in Linux, add one before the file name.)

Ls-l: View the directory details in a list

We know that in Linux everything is a file, the command is a file, the device is a file, the configuration is also a file, the command to view the path of the command file is which.

15. Browse File Contents: Cat

This command displays the contents of the file in a read-only manner on the desktop

Cat usage is as follows:

Head: The first 10 lines of the file are displayed by default

Head-n: Displays the first n rows of a file

Tail: Displays the contents of the last 10 lines of the file by default

Tail-n: Display file after n rows

MORE: Every time a page is displayed on the screen

Iv. browsing, management and maintenance of catalog files

In a Linux or Unix operating system, all files and directories are organized into an inverted tree structure that starts with the root node.

The root directory is represented by "/"

Here are some of the important directories in Linux

Bin directory: Used to store common executable files
Sbin Directory: The executable file used to store the system
Home directory: Used to store the user's own files or directories, where Superuser Root's home directory is/root, and the normal user's home directory is stored in the/home directory, and uses the user name as the last level directory (family directory) name, such as the cat user's home directory is/home/cat
Dev directory: Device files directory
ETC Directory: Configuration file directory

LIB Directory: library file directory

Proc Directory: Process files directory

TMP directory: The directory where temporary files are stored

Media directory, opt-in, and MNT directories: directories for use by users

Linux Basics (i)

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.