Linux Basics and Related commands

Source: Internet
Author: User
Tags bz2 gz file

Linux Basics

Red Hat Linux installation and service Basics

Off iptables firewall: chkconfig iptables off

Turn off selinux: Open /etc/sysconfig/selinux file Modify "selinux=disabled"

Linux boot process:

1. boot Blos self test

2.MBR boot MBR (master boot record located on disk 0 cylinder 0 Track 1 sector, total 512 bytes) 512=446 (Grub boot) +64 (partition table) +2 (end check mark)

3.Grub Menu start: Corresponding file in/boot/grub/grub.conf

4. Load the memory file: the corresponding file in/boot

5.Init process initialization: The INIT process is the first process of a system.

System Service Control: Service Name control type

Method Two:/etc/rc.d/init.d/Service name control type

Control type: Start (start) Stop (stop) restart (reboot) Reloand (reload) status (status): Server Crond Stop

/etc/rc.d/init.d/crond Stop

View Run Level: RunLevel

Toggle Run Level: init level

View Services: Chkconfig--list Service Name

Modified: Chkconfig--level Level service name on (off)

Chkconfig--level, Crond on

directory and file management

Cat (if the file has multiple screens, only the last screen is displayed)

More (split screen display)

Less (split-screen display, more features than more)

Head (View the header of the file, down from the first line)

Tail (View the end of the file, from the last line upwards)

Tail-f (trace log)

Contents of the statistics file (WC):-L (statistic line)-C (bytes)-W (number of words)

Retrieving the contents of a filtered file grep command

Common Command options:-I: find is ignore case

-V: Reverse lookup, output rows that are not equal to the lookup criteria

The characters to look up are enclosed in double quotation marks: "^" Table with ... The beginning of the "... $" table with ... End

"^$" indicates a blank line

File compression and decompression (only for files)

1.gzip (compressed suffix. gz) unzip the. gz file: gzip-d or Gunip

2.bzip2 (compressed suffix. bz2) unzip. bz2 file: bzip2-d or Bunzip2

Make a large file: Cat/dev/zero > File name

CTRL + C END

Tar (archive and compress, backup and restore)

Archive and Compress: Tar czf. tar.gz (directories and files to compress)

Tar cjf. TAR.BZ2 (compressed directories and files)

Unzip. tar.gz file: Tar zxf. Tar.gz-c target Directory

Unzip. tar.bz2 file: Tar xjf. Tar.bz2-c target Directory

Use of VI:

VI Three modes and toggle: command input last line

Operation in command mode:

Inline Jump: #G # (any number)

Delete a character: x Delete line: DD multiple lines (#dd) copy line: yy Multiline (#yy)

Paste: P Undo: U Find: | What to look for (top to bottom)? What you need to check (from bottom to top)

Last line mode:: W Save: Q Exit Not saved: Wq save exit (ZZ)

Content substitution::% s/dd/new/g (replaces the entire document's DD with new)

% represents all of the entire document in line G

Display line number: Set CNU

installation and replacement management procedures

Mount Disc: Mount/dev/cdrom/media

View Mount: Mount

Unmount disc: Umount/dev/cdrom or Umount/media

RPM Package Management:

RPM Package Installation: RPM-IVH package name. PM

I (install) v (Display information) H (progress bar showing #)

RPM Package Uninstall: RPM-E Package name--nodeps (ignore dependencies)--force (mandatory)

Rebuild RPM Database: RPM--rebuiddb rpm--INITDB

Compile and install the software process:

1.Tar unpack: Unzip and release the source code package to the specified directory

2./configure Configure--prefix=/installation directory setup directory, install modules and other options

3.makecompilation: Generate executable binaries

4.make install: Copy binary files to system, configure application Environment

account and Rights Management

A. User management:

1. User-related configuration files

/ETC/PASSWD (user account file)

/etc/shadow (password file)

/etc/skel (template directory)

2. User-related commands:

Useradd (Create User) Usermod (modify user properties) passwd (Modify mask and lock)

Userdel (delete user) Chage-l user (view user's expiration time)

History (view command Histories)

two. Management of groups:

1. related management files for the group:/etc/group

2. Group-related commands: Groupadd (Create) Groupdel (delete) gpasswd (add Users in Group)

three. permissions and Attribution

1. Permissions: R-Read W-write X-Executable

-|rwx (Genus Master U) |r-x (Group G) |r--| Zhangsan (U) Xiaoshou (g) a.txt (file name)

Modify Permissions: chmod Letter: U (master) G (Group) O (Others) a (all Ugo)

+ (ADD)-(remove) = (overwrite)

such as: chmod u-w a.txt

chmod a+x A.txt

chmod G-rx A.txt

Number representation: R (denoted by 4来) W (denoted by a) x (represented by a)

such as: CHOMD 754 a.txt

2. Change of Attribution chown

Chown Master file or directory such as: Chown Lisi A.txt

Chown: A group file or directory such as: Chown:caiwubu a.txt

Chown: Genus group file or directory such as: Chown Lisi:caiwubu a.txt

Disk and file System Management (i)

Disk Management:

A. View partitions or hard disk fdisk-l

two. partition (in/dev/sdb column) Q (do not save exit)

Fdisk/dev/sdb

M (View Help)

N (new Partition) Note: When using n new partition, use to P (primary partition), E (extended partition), L (logical partition)

D (Delete partition)

P (Show partition Table)

W (Save exit)

Three Creating file system formatting

1.EXT4 Type

Mkfs-t EXT4/DEV/SDB1 or MKFS,EXT4/DEV/SDB1

2.swap type (swap partition)

Conversion: MKSWAP/DEV/SDB5

Enable to swap partition: SWAPON/DEV/SDB5

Disabled: SWAPOFF/DEV/SDB5

Four. Mount

1. Temporary Mounts

(1) mount a partition (/DEV/SDB1) mount/dev/sdb1/test

(2) Mount Disc Mount/dev/cdrom/media

(3) mount a disc image file

Make an image file: Cp/dev/cdrom a.iso

Mount: Mount-o Loop a.iso/yy

2. Permanent mount (auto mount)

Using Vim to modify the/etc/fstab file, add a line such as:

/dev/sdb1/test EXT4 Defaults 0 0

Five. viewing mount conditions

1. View mount: Mount

2. View mounted disk details: Df-ht

Six Uninstall

Can unload mounted directories and devices

such as: UMOUNT/DEV/SDB1 or Umount/test




This article from "Xu Willow Blog" blog, reproduced please contact the author!

Linux Basics and Related 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.