Basic knowledge of Linux

Source: Internet
Author: User
Tags bz2

Linux basic knowledge

Linux is strictly case-sensitive, and all content is saved as files, including hardware.
Linux does not have the concept of extension, and does not differentiate file types by extension. But there are some conventions that extend the name:
Compressed package:. gz. bz2. tar.bz2. tgz
Binary packages:. rpm
Web page files:. html. php
Script file:. sh
Configuration file:. conf
Hardware settings file name
IDE HDD/dev/hd[a-d]
SCSI/SATA/USB HDD/dev/sd[a-p]
Optical drive/dev/cdrom or/DEV/HDC
Floppy/dev/fd[0-1]
Printer (25-pin)/dev/1p[0-2]
Printer (USB)/dev/usb/1p[0-15]
Mouse/dev/mouse
Note: Programs under Windows cannot be installed and run directly in Linux.

the advantages of the Linux character interface are as follows:

1. Less system resources are consumed
2, reduce the possibility of error, attack

Partition type

Primary partition: Can only have up to 4
Extended partitions: There can be up to 1, a primary partition with an extended partition of up to 4, no data to write, and only logical partitions.

Mount

Must be partitioned

/(Root partition)
Swap partition (swap partition, memory twice times, no more than 2GB)
Recommended partitioning
/boot (boot partition, 200MB)
Show
Start ID: [[email protected] ~]#
Root indicates that the current logged on user is an administrator
Bogon indicates host name
~ Indicates the current directory
#是管理员的提示符
$ is a prompt for ordinary users


When there are multiple options that can be written together, options include a simplified option with a full selection such as-a equals--all
Note : Individual command use does not follow this format

File

File type: Linux consists of 7 file types that represent the file type as the first bit of the file bit:
-Documents
Catalog D
L Soft Link File
Linux Special file types block device files, character device files, socket files, and pipe files.
file Identity: Total file bits Ten In addition to the first 1 bit represents a file type outside 9 bit per 3 a bit is a group that represents the owner of the file, the owning group, and other people permissions.
File permissions:
R Read
W Write

file Information : The size of the code file, the last time the file was modified, and the file name.

Note: Files with a. Start file name in Linux are hidden files

Common level of directory role

/root directory
/bin Storage System Command
/USR system resource Save directory containing applications that do not normally need to be modified, command program files, libraries, manuals, and other documents
/usr/sbin storing system commands that only administrators can perform

/lib Store Function Library
Home directory for user files, where user data is stored in this directory
/root Administrator's Home directory
/mnt empty directory, storage temporary mapping file system, often the floppy disk drive and CD-ROM mounted in the floppy and CDROM subdirectories here
/media empty directory, storing temporary mapping file system, old Linux no this directory
/misc empty directory, storing temporary mapping file system, old Linux no this directory

/sys cannot operate directly, storing stored process and system Information

/var contains frequently changing files generated by the system

Shutdown Instructions:
shutdown [Options] Time
Options:
-C: Cancel the previous shutdown command
-H: Shutdown
-R: Restart

Instructions:

Shutdown-h now immediately shuts down the machine
Halt
Poweroff
Init 0

Reboot command:

Reboot
Init 6

System operating level:

0 Turn off the machine
1 single user, Safe mode
2 not fully multiuser, no NFS service included
3 Full Multi-user
4 Not assigned
5 graphical interface
6 restart
Cat/etc/inittab #修改系统默认运行级别
# Inittab is a used by upstart for the default runlevel.
#
# ADDING Other CONFIGURATION here would have NO EFFECT on YOUR SYSTEM.
#
# System initialization is started by/etc/init/rcs.conf
#
# individual runlevels is started by/etc/init/rc.conf
#
# Ctrl-alt-delete is handled by/etc/init/control-alt-delete.conf
#
# Terminal Gettys is handled by/etc/init/tty.conf and/etc/init/serial.conf,
# with configuration In/etc/sysconfig/init.
#
# For information on what to write upstart event handlers, or how
# Upstart works, see Init (5), init (8), and Initctl (8).
#
# Default RunLevel. The runlevels used is:
# 0-halt (do not set Initdefault to this)
# 1-single User mode
# 2-multiuser, without NFS (the same as 3, if you don't have networking)
# 3-full Multiuser mode
# 4-unused
# 5-x11
# 6-reboot (do not set Initdefault to this)
Id:3:initdefault:
RunLevel   #查询系统运行级别

Login :

View logged in User information: W User name
User: Username for login
TTY: Login Terminal
From: Which IP address to log on from
[Email protected]: Login time
Idle: User idle time
JCPU: Refers to the time taken by all processes connected to the terminal, which does not include the past background job time, but includes the time occupied by the currently running background job
PCPU: Refers to the time occupied by the current process
What: the currently running instruction
Log out: Logout

Some basic instructions:

Who: Query user information for current login and past login
Last: View all users ' final logon times
Lastlog: Read/var/log/lastlog file contents by default
Shell Restart command:
The shell is a command-line interpreter that provides the user with an interface system-level program that sends a request to the Linux kernel to run the program, allowing the user to start, suspend, stop, or even write programs with the shell. The shell is also a very powerful programming language, easy to write, easy to debug, flexible. The shell is the scripting language that interprets execution, and the Linux system commands can be invoked directly in the shell.
Syntax Type:
Bourne Shell: The primary file name is SH
Syntax types: sh, ksh, Bash, PSH, zsh
C Shell: Mainly used in BSD version of UNIX system
Syntax type: CSH, tcsh
To view the SHELL type of the current system: Echo $SHELL
Edit Script : VI hello.sh
Exit script: After you edit in Vim, press ESC, go back to normal mode, and enter ": Wq", Return to execute
Script execution:
1, give the executive permission to run directly
chmod 755 hello.sh
./hello.sh
2, or, you can execute the script via bash call
Bash hello.sh

Basic knowledge of Linux

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.