Start and close the system
Linux Shells
Use BASH Shell
At ---- schedule, check, and delete jobs in the queue
Cat ---- connect the file and print it to the standard output
CD ---- Change directory to be able to process absolute and relative paths
Chmod ---- change the file protection permission
Chown-change the owner and group of Files
Clear ---- clear the screen (like CLS in DOS)
CP ---- copy an object
Crontab-operate the daemon and execution schedule of each user
Date ---- print or set the system date and time
Dd ---- copy an object (and convert it at the same time)
DF ---- report the remaining disk space
Du ---- report disk space usage
File ---- test file and directory types
Find ---- search for files in a directory
Grep ---- search for matched rows in the file and Output
Gzip-compress or expand a file
Head ---- display the first few lines of the file
History ---- display historical Command records
Kill ---- abort a process
Last ---- shows how many users or terminals have logged on to the machine
Less ---- you want to use the more command to display files by PAGE
Ln ---- establish a connection Between Files
Ls ---- list files in the current directory
Man ---- display online manuals with certain formats
More ---- the command can read the text page by page
Mount ---- install a File System
MV ---- rename the file
Passwd ---- set the User Password
PS ---- command to list Running Processes
Reboot ---- restart the system
Rm ---- command used to delete files
Su ---- create and edit UNIX archive files
Tar ---- create and edit UNIX archive files
Touch ---- change the time parameter of the file
WC ---- count the number of bytes, number of words, and number of rows in a file
Who ---- view other login users
Which ---- which -- display the full path of the command
Ping ---- command-determine whether the machine on the network can reach or reach the speed
Multi-task
Output redirection
Understanding processes
--------------------------------------------------------------------------------
In Linux, there are two operation interfaces: X Window mode (KDE by default) and Console mode (console ). The two interfaces are similar to Windows and DOS.
If you want to change to Console mode in X Window mode, you only need to press Alt + F1 (or F2... F6) key. A new waiting window will appear on the screen. You can log on to the system again in Console mode. If you want to return to X Window mode in Console mode, press CTRL + ALT + F7 at the same time.
If the X Window mode is not enabled and you want to start the X Window mode from the console mode, enter startx (or KDM) in the Console mode to start the X Window.
In the above two chapters, we have introduced the operation of the X Window (KDE by default). In this chapter and the next chapter, we will mainly discuss the operations in the Console mode, the corresponding KDE operation will also be inserted between them.
6.1 start and close the system
Start the system
If you have installed lilo during the installation process, you can start the system. When lilo is started, the screen displays:
Lilo:
Click the tab key to display all operating systems that can be started. Enter the name of the displayed operating system to start the corresponding operating system. Type Linux to start bluepoint Linux & 127. If you press the Enter key directly or wait for 5 seconds, you can also start the bluepoint Linux & 127; operating system.
Another way to start Linux is to run loadlin.exe in DOS/windows. For more information, see.
Logon Program
Linux is a multi-user system. If you want to use the system, you must identify the user for authentication. This is called a registration program. During the installation process, we have created a root Super User Account. After the system is started, log on to the command line, type root, and then enter the password ("password "). If the password is correct, the logon is successful.
Suggestion: after entering the system, create a second account (non-privileged user) for daily use.
Because the root account has the ownership of the resources of the entire system, it is a management account rather than a non-account.
If you want to create a work account, two steps are required:
Step 1: create a user registered account.
Type: addusr login_name
Here, login_name is the registered account you selected (do not use root ).
Step 2: create an account and password.
Type: passwd login_password
Here, login_password is the account password you selected (it is best not to use the same password as the root password ).
To use all privileges of the system, run the su command and enter the root password in the root command line. In addition, you can use the File Manager in superuser mode to obtain system resources. The usage is as follows:
"K menu" --> "System Application" --> "File Manager (superuser mode )"
If your colleague (family member ...) To use your computer system, you should create new user accounts for these users, rather than telling them the root account. Note: You must take full advantage of Linux's multi-user operating system.
Shut down the system
There are many ways to shut down the system, but do not turn off the power directly!
Because Linux uses cache and disks (hard disks, floppy disks, etc ...) To accelerate the input/output. If the power is directly turned off, the stored data may not be actually written to the disk, which may lead to data loss.
Correctly shut down the system is as follows:
Type the/sbin/halt command (or directly type halt), wait for the system to suspend the message (systemhalted), and then close the system.
The system is quickly shut down by pressing CTRL + ALT + DEL (like DOS), the system will Uninstall all peripheral devices, and wait for the computer to re-initialize, and then turn off the power.
Use KDM sessions. Right-click anywhere on the desktop and select "logout ". Then select "Disable" system or "restart" system.
What will happen if the power is directly turned off or power is down? When Linux restarts the system, it will check that the disk is not correctly detached (fsck operation ). After several minutes. The system may start correctly.
6.2 Linux Shells
Once you enter the system, you will see the $ prompt, prompting you to type the command. The program that waits for the command is called shell, which transfers the command to the Linux kernel.
Linux has many different shells: Bash, CSH, KSh, tcsh, sh, zsh ......
In bluepoint Linux & 127; system, shell selects "bash" because bash shell is simple and powerful.
If you want to know which shell is currently used, simply type echo $ shell.
You can find the shell type that the system is using.
Note: different shells have different syntaxes.
6.3 use BASH Shell
Like the dossystem, the Linux console also uses the command line method. You must enter a command in the console to execute the command.
Shortcut
The general keyboard shortcuts are:
. CTRL + A to start line
. CTRL + u clear the current row
. CTRL + C stop running program
. Use a semicolon to type several commands in the same line.
. The upper and lower keys can obtain command history records.
Automatic name completion
In Linux, the program and command names are sometimes very long. Bash supports automatic name completion.
Enter the command name, and then click the tab key. The system will automatically complete the command, program, or directory name for you.
For example, if you want to use the extract program bunzip. Type
$ Bu
Click the tab key: Bash displays all the names starting with Bu. For example:
Buildhash buildin bunzip
Type N (bunzip2 is a unique name, and the third character is N), and then press the tab key. Shell will fill in the name for you in the command line. You only need to press the Enter key to execute the bunzip2 command.
At command
At, batch, Atq, atrm: Schedule, check, and delete jobs in the queue.
At [-V] [-Q queue] [-F file name] [-mlbv] Time
At-C job [job…]
ATQ [-V] [-Q queue] [-v]
Atrm [-v] job [job…]
Batch [-V] [-Q queue] [-F file name] [-mV] [time]
At: Execute the job at the specified time.
ATQ lists jobs in the queue. If you are a Super User, all jobs in the queue are listed.
Atrm deletes a job in the queue.
Batch runs jobs with a low priority. As long as the system loadavg (average system load) is less than 1.5 (or the value set in Atrun), it can start to execute jobs.
Super Users can use at series commands in any situation. Generally, the permissions for using AT commands are controlled by the file/etc/at. allow,/etc/at. deny. If/etc/at. allow exists, only users listed in this file can use AT commands. If the/etc/at. allow file does not exist, check the file/etc/at. deny. You can use at series commands as long as they are not listed in this file. The default configuration is that the file/etc/at. deny is an empty file, which indicates that all users can use a series of commands.
For example:
Execute the job in the file workfile at eight o'clock A.M. after two days.
[Test @ bluepoint/] $ at-F workfile 8 + 2 days
Cat command
Cat --- connect the file and print it to the standard output.
Cat is often used to display files, similar to the DOS command type.
For example:
Display file content
[Test @ bluepoint/] $ cat File
Connect file1 and file2 and output them to file3.
[Test @ bluepoint/] $ cat file1 file2> file3
CD command
CD --- change the directory to process absolute and relative paths.
For example:
If you want to enter the ETC/subdirectory in the root directory. Type (relative directory ):
[Test @ bluepoint/] $ CD etc/
To enter the/usr/bin directory, type (absolute directory ):
[Test @ bluepoint/] $ CD/usr/bin/
Some practical options of this command are:
Return to the parent directory (note that there is a space between CD and)
[Test @ bluepoint/] $ CD ..
Return to the current directory.
[Test @ bluepoint/] $ cd.
Cd ~ To my directory
[Test @ bluepoint/] $ Cd ~
Chmod command
Chmod -- change the file protection permission
File Protection controls users' access to files. There are three security levels: owner level, group access level, and other user access level. Among the three levels, there are three permissions: Read (R), write (w), and execute (X ). (You can use the LS-LG command to view the group to which a file belongs ).
For an object, the read permission means that the object content can be viewed, the write permission can be used to modify or delete the object, and the execution permission can be used to execute the object. For a directory, read permission means you can view the content in the directory. Write Permission means you can create a new file in the directory and delete the file from the directory, the execution permission means that you can switch from one directory to another.
Protection permission: The format is [ugoa] [[+-=] [rwxxstugo…] [...] "Ugoa" controls which users have the same permissions on the file. (u) The file owner, (g) the users in the same group as the file owner, and (0) users in other groups, (a) all users. The operator "+" adds user permissions to each directory file. The operator "-" cancels user permissions. The operator "=" gives users only these permissions. "Rwxxstugo": (r) read permission (w) Write Permission (x) Execution permission (and access to directory) (X) only when the target file is executable to some users or the target file is a directory, the X attribute (s) is appended and the user or group ID (t) is set) save the program text to another user in the group (o) where the (u) target file owner (g) target file owner is located. If a number is used to represent an attribute, (0) No permission (1) execution right (2) read right (4) Write Right, and then add, therefore, the format of the numeric attribute should be 3 Octal numbers 0 to 7. The order is (u) (g) (o) File Name: list of files whose permissions are to be changed separately by space, wildcard characters are supported.
Example:
Allow all users to execute testfile
[Test @ bluepoint/] $ chmod A + x testfile
Allow all users to read the file testfile
[Test @ bluepoint/] $ chmod 222 testfile
CHOWN command
Chown -- change the owner and group of the file.
User: User Name or user ID.
GROUP: it can be the group name or group ID.
File Name: list of files separated by spaces to change permissions. Wildcards are supported.
For example:
[Test @ bluepoint/] $ chown HOST: Test file1
Change the owner of file file1 to test of the Host group.
Clear command
Clear -- clear the screen (like CLS in DOS ).
For example:
[Test @ bluepoint/] $ clear
Clear the screen and the prompt will be moved to the upper left corner.
CP command
CP -- copy an object
Usage:
CP [Options] target file of the source file
Option:
-F, -- force: forcibly overwrite existing target files
-I,-interactive: a prompt is displayed when an existing target file is forcibly overwritten.
-R, -- Recursive: Copies the entire directory.
For example:
[Test @ bluepoint/] CP sourcefile destfile
Copy the sourcefile to destfile.
Crontab command
Crontab-operate the daemon and execution schedule of each user.
Crontab file [-u user] -- replace the current crontab with the specified file.
Crontab-[-u user] -- replace the current crontab with the standard input.
Crontab-L [user] -- list the current crontab of a user.
Crontab-E [user] -- edit the current crontab of the user.
Crontab-d [user] -- delete the current crontab of the user.
Crontab-C dir -- specifies the crontab directory.
Crontab file format: m h d m d cmd
M: minute (0-59)
H: hour (0-23)
D: Day (1-31)
M: Month (1-12)
D: The day of the week (0-6, 0 is Sunday)
CMD: The program to run. The program is sent to the shell for execution. The shell contains only three environment variables: User, home, and shell.
For example:
List the current crontab of a user
[Test @ bluepoint/] $ crontab-l
$ Min hour day mouth dayofweek command
8 6 *** clear
[Test @ bluepoint/] $
Date command
Date -- print or set the system date and time
Date [-u] [-D datestr] [-s datestr] [-- UTC] [-- Universal] [-- date = datestr] [-- set = datestr] [-- help] [-- version] [+ format] [mmddhhmm [[CC] YY] [. SS]
+ Format: controls how to display dates.
Command: %
N: New Line
T: Tab
Time Domain
% H hour (00 .. 23)
% L hour (00 .. 12)
% K hour (0 .. 23)
% L hour (1 .. 12)
% M hour (00 .. 59)
% P am or PM
% R