First, basic concepts and operation
1). Important Shortcut keys:
[Tab]
Using the TAB key to complete the command, the TAB key is next to the letter Q, the greatest benefit to you is that when you forget the full name of a command, you can simply enter a portion of its beginning and press TAB to get a hint or help:
Of course, not only complete the command, complete the directory, complete the command parameters are no problem:
[Ctrl + C]
Think you have not encountered this situation, when you inadvertently entered a command in the Linux command, or the wrong use of a command, resulting in the terminal you can not expect, for example, only the cursor in the blink can not continue to enter the command, or constantly in the output of a lot of you do not want results. What should you do if you want to stop immediately and return to your controllable state? At this point you can use CTRL + C to forcibly terminate the current program (you can rest assured that it does not cause the terminal to exit).
2). Learn to use historical input commands
3). Learn to use wildcard characters
Use the Touch command first to create 2 files with the suffix txt:
$ Touch Adsfasd.txt Wergjlkas.txt
You can give the file a random name, if after a long time, you have forgotten the file name of the two files, and now you want to find the two text files in your large heap of other files, you can use wildcard characters:
$ ls *.txt
When creating a file, if you need to create multiple files at once, for example:"Love_1_linux.txt,love_2_linux.txt,... love_ 10_linux.txt ". Very handy in Linux:
4). Learn to get help in the command line
You can get a detailed description of a command and how to use it in the following ways:
$ mans <command_name>
For example, if you want to see how the man command itself is used, you can enter:
Man Mans
For more detailed help, you can also use the Info command, but it's usually enough to use man. If you know the purpose of a command, just want to quickly see some of its specific parameters, then you can use the--help parameter, most of the commands will have this parameter, such as:
$ ls--help
Homework:
This course introduces an interesting Linux command at the end of each section of the experiment, which describes a command banner that can output graphic characters, starting with the effect:
Experiment Three: User and Rights Management
1. View the user
2. Create a user
3. User groups
4. Delete a user
Second, Linux file permissions
1. View File permissions
2. Change the file owner
3. Modify File Permissions
Homework
Add a user loutest, use sudo to create the file/opt/forloutest, set to user loutest can read and write. And the operation process is written into the experimental report.
Experiment Four
Directory structure and file basic operation
First, the LINUX directory structure
2. Directory path
Path
Absolute path
Relative path
Second, the basic operation of Linux files
1. New
Create a new blank file
Use the touch command to create a blank file, about the Touch command, which is mainly to change the time stamp of the existing file (for example, the last access time, last modified time), but it does not add any parameters, only specify a file name, You can create a blank file for the specified file name (without overwriting a file that already has the same name)
2. Copying
Copying files
Use the CP (copy) command to copy a file or directory to the specified directory. Copy the previously created "test" file to the "/home/shiyanlou/father/son/grandson" directory
3. Delete
deleting files
Use the RM (remove files or directories) command to delete a file or directory:
$ RM Test
Sometimes you will encounter a file that you want to delete as read-only permission, and using RM Delete directly displays a prompt, as follows:
4. Move file and file rename
Moving files
Use the MV (move or rename files) command to move the file (cut). Move the file "File1" to the "documents" directory MV source directory file destination directory
5. View Files
viewing files using the CAT,TAC and NL commands
Both commands are used to print the file contents to the standard output (terminal), where cat is a positive sequence display, and TAC is displayed in reverse order.
Standard input and output: when we execute a shell command line normally will automatically open three standard files, namely standard input file (stdin), default corresponding to the terminal's keyboard, standard output file (STDOUT) and standard error output file (stderr), All two files correspond to the screen being redirected to the terminal so that we can see the output directly. The process will get input data from the standard input file, output normal output data to the standard output file, and send the error message to the standard error file.
For example, we want to view the passwd files that were previously copied from the "/etc" Directory:
6. View File types
As I mentioned earlier, the types of files under Linux are not judged by the file suffix, and we typically use the file command to see the type of files:
7. Edit the file
Editing files under Linux usually we use a dedicated command-line editor like (Emacs,vim,nano), because the content of the editor involved in Linux is more and more important, so we have a separate basic course specifically about one of these editors (VIM).
Homework:
Experiment Five
Environment variables and file lookups
I. Environment variables
1. Variables
2. Environment variables
Simple understanding of the concept of variables, it is very good to explain the environment variables, environment variables are scoped than the custom variable, such as the shell environment variables acting on itself and its child process. In all Unix and Unix-like systems, each process has its own set of environment variables, and by default, when a process is created, it is explicitly specified in the process creation, and it inherits most of the environment settings of its parent process. The shell program also runs on the operating system as a process, and most of the commands we run in the shell will run as a child process of the shell.
3. Search path and order of commands
You might have had a long question about it, and we entered a command in the shell, how did the shell know where to find the command and execute it? This is a search through the environment variable path, and users familiar with Windows may know that there is a PATH environment variable in Windows. This path saves the search path for commands executed in the shell.
4. Add a custom path to the "path" environment variable
6. How to make environment variables effective immediately
After we have modified a configuration script file in the Shell (for example,. ZSHRC in the zsh configuration file home directory), it is troublesome to leave the terminal to reopen or even reboot the host after each time, and we can use the source command to get it to take effect immediately.
Second, search documents
Search-related commands are commonly used in several whereis,which,find,locate.
Homework:
Experiment Six:
Information Security system design basics first week study summary