One of Linux learning

Source: Internet
Author: User
Tags echo display system log touch command

Linux Learning Article One: Linux basic operations

I. Copying files and directories

1. copy files or directories using the CP command

CP source file (folder) destination file (folder)

Common parameters:

-R recursively replicate entire directory tree

-V Show More information

Second, move, rename files or directories

Move or rename a file or directory with the MV command

MV File destination directory (you can rename files if you specify a file name)

MV Linuxcast-2 linuxcast.net/cast move linuxcast-2 to Linuxcast.net and rename to cast

MV Nasu Linuxsa renaming Nasu to Linuxsa

Iii. Creating and deleting files

You can create an empty file or update the file time with the Touch command

You can delete a file or directory by using the RM command

Common parameters:

-I. Interactive

-R recursive deletion includes all content in the directory

-F Force Delete, no warning prompt (very cautious when using)

Iv. Creating and deleting directories

Creating a directory with the mkdir command

Delete an empty directory with the rmdir command

Delete a non-empty directory with the Rm-r (-f) command

  

Linux Learning Chapter II: Linux Common commands

1. Date and time

Date

Date-u

Date +%y--%m--%d

Date-s

2.hwlock Display Hardware clock time

3.cal Viewing calendars

4.utime system Time

5.echo Display Input User

6.

Cat command: Display file contents

More command: Display the file contents in the way of page flipping (only page down)

Less command: Display the file contents (with Page up and down)

7.head-n Show file header n rows

Tail-n Show end of file n rows

8. View hardware Information

LSPCI: View PCI Device-v parameter details

LSUSB: View USB Device-V details

Lsmod therefore view the loaded module (drive)

9. Shutdown, restart

Shutdown

-H shutdown

-R Restart

-h now shuts down = = Poweroff

-h +10 10 minutes after shutdown

-H 23:30 23:30 shutdown

-R now restart immediately

10. Archive, Compress

Zip to compress file format: Zip files to compress file names after compression

Unzip unzip a file

gzip Compressed Files

Tar to archive Files (archive command)

TAR-CVF Out.tar Linuxcast

TAR-XVF Linuxcast.tar

TAR-CVZF backup.tar.gz etc archive and then compress (most commonly used)

11. Find

Locate quickly find files, folders, this command needs to pre-establish a database, the default daily update, check the database, can be manually established with the Update command, update the database

Find advanced search files, folders; format: Find find location Lookup parameters

For example, find/(current directory)-name (by name) *.conf (parameter)

Find/-perm (by authority) 777

find/root/-type (search by type) d

Find/-name "A *" -exec ls-l {}\ cyan part and red part are commands, black part is fixed format. Indicates that the cyan part of the lookup structure is sent to the red part of the command execution

Other parameters:

-user Users

-group User Group

-time modification Time

-size size

Linux Learning Chapter III: VI text compiler

First, VI, VIM

Text Compilation tool: Ex-->vi-->vim

Vim + target path file

Three modes: 1. Command mode (default)

2. Insert mode I enter ESC to return to command mode

3.ex Mode: Enter

(1) Command mode:

I insert before cursor

o The next line of the current row is inserted

DD Delete entire row

YY when dynamic compaction copy

N+yy Current N Row replication

U recall Last Action

P will copy the insertion cursor after

R replaces the current character

/Find Keywords

(2) Ex mode:

: W Save current changes

: Q exit

: q! Force exit

: X Save and exit

: Set number Displays line numbers

: ! System command executes a system command and displays the result

: SH switch to command mode CTRL + D switch back to vim

Linux Learning Chapter Four: Basic Disk Concepts

One, disk, partition

(1) Concept distinction:

Cylindrical surface

Fan Area

Head

(2)/dev/hd[a-z] or sd[a-z]

HD indicates IDE device, SD indicates SATA, SCSI, SAS, USB and other devices

(3) Zoning concept

/DEV/SDA[1-10]

Second, MBR, GRT another concept of zoning

(1) MBR:

Traditionally, the vast majority of PC devices using BIOS Use this partitioning method

Limited number of partitions, only support no more than 2T, accounting for 512 bytes

Primary partitions up to 4

(2) GRT:

Divided into primary partition, extended partition, logical partition, extended partition occupies one primary partition, under extended partition can create logical partition

Supports over 2T, backwards compatible MBR

Must be used on a UEFI-enabled hard disk and must use a 64-bit system

(3) using FDISK for disk partition management

1.fdisk commands can only be used by super users

2.fdisk-l can list all installed disks and their partition information

3.fdisk/dev/sdb

4.N Create new Partition E extended partition p primary partition

5.P List all the current partitions

6. Logical partition number always starts from number 5th

7.partrobe command kernel update partition table

Linux Learning Article Five: Linux file system

First, the Linux file system

1. The operating system manages files and data through the file system, and the process of creating a file system is also known as formatting

2. A device without a file system is called a bare device or raw device

3. Common file systems are: FAT32, NTFS (Windows), Ext2, Ext3, Ext4 (Linux), XFS, HFS

4. Differences between file systems: Log, support partition size, support single file size, performance, etc.

Ii. introduction of the order

1.MKF2FS command

Used to create the file system: Mke2fs-t Ext4/dev/sda3

Common parameters

-B blocksize Specify file system size

-C Check bad block when setting up file system

-L label Specifies a volume check (name)

-j creating a file system log

2.MKFS

Simple compared to mke2fs, but with few supported parameters

3.dunpe2fs

viewing partition file System Information

4.Journal logs (recovery on error)

Using a file system with a log, the file system uses a two-phase commit to perform disk operations, and the file system will do the following when the disk operation is performed:

A. The file system writes the specific contents of the prepared transaction to the log

B. Operation of the file system

C. After successful operation, delete the specific contents of the transaction from the log

5.e2label

Used to add tags to the file system (recommended capitalization)

E2LABEL/DEV/SDA1 Name

6.FSCK

Used to check and repair corrupted file systems

Fsck/dev/sda1

The-y parameter is not prompt and is repaired directly

Fsck typically automatically determines the type of file system, and if the file system corruption is more severe, specify the file system type using the-t parameter

For corrupted data that is identified as a file (the file system is not logged) fsck puts the file in the Lost+found directory

The disk is fsck when the system starts

One of Linux learning

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.