How to get started with Linux

Source: Internet
Author: User
Tags ftp commands ssh server
From getting started with Linux to mastering 52-Linux general technology-Linux technology and application information, the following is a detailed description. Q1 who are Linux developers?
A: Finnish college student Linus Torvalds
What are the common kernel versions of Q2 Linux?
A: 2.6.x
Q3 what hardware platforms can be run in Linux?
A: Dell, IBM, HP, Oracle, and VERITAS
Q4: In which year was Linux 1.0 released?
A: in 1994, the official core of Linux 1.0 was published.
Q5 what is the role of swap partition?
A: used for virtual memory, similar to WINDOWS page files.
Q6 what are the boot loading methods in Linux?
A: Common GRUB LILO
Q7 Ext2 ext3 which Linux version is used in the file system?
A EXT2 is A common file system before red hat linux 7.2. The current version usually uses the EXT3 file system.
Q8 how to clear MBR after Linux is uninstalled
A: You can use the FDISK command to delete MBR.
Q9 what are Linux restart and shutdown commands?
A: halt command
Function: Shutdown
Format: halt [-n] [-w] [-d] [-f] [-I] [-p]
Note:
If the system runlevel is 0 or 6, the system is shut down. Otherwise, the shutdown command (with the-h Parameter added) is used to replace
Init command
Function: changes the running level of the system.
Format: init [0123456Ss]
Note: init is the parent route of all processes. It will start from this command when it is started (you can use ps-aux to check whether the first itinerary is init ), refer to the/etc/inittab file to complete the entire boot program. There are a total of eight runlevels, and the change can only be changed through the telinit command.
Parameters:
0 indicates that the startup execution level is 0, which is used to disable the system.
1. the startup execution level is 1, which is used for single user mode)
5. the startup execution level is 5, indicating the mode when the window is X.
6 boot execution level: 6, used to reboot
S or s is not used directly. It is used when Level 1 is executed at startup, when S or s is added, the file "/etc/inittab" is not referenced. For details, refer to the file "/etc/inittab" and "/etc/rc. d/rc2.d,/etc/rc. d/rc3.d,/etc/rc. d/rc5.d directory
Reboot Command
Function: restart the system.
Format: reboot [-n] [-w] [-d] [-f] [-I]
Note: If the runlevel of the system is 0 or 6, restart the system. Otherwise, replace the shutdown command with the-r parameter.
Parameters:
-N: Do not write the memory data back to the hard disk before restarting.
-W: The record is not written to the/var/log/wtmp file.
-D: Do not write the record to the/var/log/wtmp file (-n contains-d)-f: Force reboot, do not call the shutdown command
-I: Stop all network-related devices before restarting.
Example:
Reboot restarts.
Reboot-w is used as a reboot simulation (only record does not actually reboot ).
Shutdown command
Function: disable the system.
Usage: shutdown [-t seconds] [-rkhncfF] time [message]
Note: shutdown can be used to shut down the program and send a message to all users before shutdown. shutdown can also be used to restart the system.
Parameters:
-T seconds: Set to shut down the program in seconds.
-K: it does not actually shut down, but only sends the warning message to all users.
-R: reboot after Shutdown
-H: Shut down after Shutdown
-N
-C: cancels the shutdown action that is currently in progress.
-F: do not perform fcsk operations when shutting down (check the Linux File System)
-F: Forces The fsck action when the instance is shut down.
Time: Set the shutdown time
Message: warning message sent to all users
What are the three common X-windows desktop environments of Q10?
A: CDE KDE GNOME
Q11 How are Linux file and directory permissions divided? What is the role and usage of the Umask command?
A: LINUX Files have four access permissions: r reading, w writing, x execution, and-no permission.
Function: the system administrator uses umask to set default permissions for users.
Format: umask mode
Description: umask 022 indicates that the default permission of the file is 022. the permission of creating a folder is 666-022 = 644.
Umask? S displays the current screen code
If you do not want to log on and modify it every time, you can add umask 077 to '/. bash_profile.
Q12 how to change the permissions of files and directories
A: run the chmod command.
Q13 how to change the file owner
A: Use the chown command.
Q14 how to display the disk partition size
A: run the df du command.
Q15 functions and usage of the CD command
A: function: change the current directory
Format: cd path
Note:
1) cd: return to the home directory of the currently logged-on user.
2) cd today: switch to the today directory under the main directory.
3) cd ..: Return to the directory on the previous layer.
4) cd/: directly switch to the root directory.
5). represents the current directory
6) .. directory at the upper level
7) ls file name: displays the file information.
Q16 how to add users?
A: Use the adduser command.
Q17 what is the maximum UID value for normal users?
A: Usually 4294967295
Q18 how do I delete the default permissions of an object?
A: Use umask777 to clear all file permissions.
Q19 how to mount and detach a File System
A: function: mount A file system.
Format: mount [-parameter] [device name] [mount point]
Note: common parameters include:
-T <文件系统类型> Specifies the file system type of the device. Common types include:
Ext2 common file systems in linux
Msdos MS-DOS fat, is fat16
Fat32 commonly used in vfat windows98
Nfs Network File System
ISO CD-ROM CD standard file system
Ntfs windows NT 2000 File System
Auto automatically detects the File System
-O <选项> Specifies the option for mounting a file system. Some of them are also available in/etc/fstab. Commonly used
Ro mounting in read-only mode
Rw mounting in read/write mode
Nouser makes the general user unable to mount
The user allows general users to mount devices.
Purpose: uninstall the file system.
Syntax: umount File System
Note:
Unmount the file system to make the file system unavailable.
Q20 what is LVM water?
A: LVM (Logicl Volume Manager) and logical Volume Manager. By using the logical Volume Manager to manage hard disk storage devices, you can dynamically divide and adjust the hard disk space.
Q21 how to view the system behavior of the current user?
A: Run Command w to view the system behavior of the current user, w root
Q22 how can I view the username of a user who has logged on to the system?
A: run the "who" command to view the logon status of the current user. who-u is more detailed.
Q23 how to view all processes?
A: ps command
Function: view the process status.
Format: ps [Option]
Note:
-E/A lists all processes.
-U: select a valid user ID.
-P: select the process under the specified terminal.
-C: select the specified file name.
-F lists all details.
-L display in long format.
-J is displayed in the job format.
-X: select a process that does not control the terminal.
Q24 how does one delete a process?
A: kill command
Function: terminate a process.
Format: kill [-s | p] [-a] PID
Note:
-S indicates the signal sent to the process. For example,-9 (Force termination) sends a TERM signal by default.
-P indicates the process ID and no signal is sent.
-A: Terminate all processes.
0 sends signals to all processes in the current process group.
-1 sends signals to all processes whose process number is greater than 1.
Q25 how do I view the ports enabled by the system?
A: Use the netstar command.
Q26 what is LVM physical volume?
A: Physical Volume ----- Physical Volume (PV) Physical Volume is at the bottom of logical Volume management. It can be A partition on the actual Physical hard disk or the entire Physical hard disk.
Q27 what is an LVM volume group?
A: volume Group -------- the volume of VG (Volumne Group) is established on the physical volume. A volume Group must contain at least one physical volume, after a volume group is created, you can dynamically add physical volumes to the volume group. A logical volume Management System project can have only one or more volume groups.
Q28 what is LVM logical volume?
A: Logical Volume ----- LV (Logical Volume) Logical Volume is created on the Volume group. unallocated space in the Volume group can be used to create A new Logical Volume, after the logical volume is created, the space can be dynamically expanded and reduced. Multiple logical volumes in the system must belong to the same volume group or different volume groups.
Q29 what is the physical area of LVM?
A: Physical area-PE (Physical Extent) Physical area is the minimum storage unit that can be allocated in A Physical volume. The size of the Physical area can be specified when A Physical volume is created based on the actual situation. The physical region size cannot be changed once determined. The physical regions of all physical volumes in the same volume group must be consistent.
Q30 what is the logical zone of LVM
A: The Logical region-LE (Logical Extent) Logical region is the minimum storage unit that can be allocated in A Logical volume. The size of the Logical region depends on the size of the physical region in the volume group where the Logical volume is located.
Q31 what is LVM volume group description area
A: Volume Group description Area ----- (Volume Group Descriptor Area) the Volume Group description Area exists in each physical Volume, describes all information such as the physical volume itself, the volume group to which the physical volume belongs, the logical volume in the volume group, and the allocation of Physical Areas in the logical volume, the volume group description area is created when you use pvcreate to create a physical volume.
Q32 how to copy files
A: cp/test1/file1/test3/file2: copy the file file1 under the test1 directory to the test3 directory and rename it file2.
Cp? Ax dir1 dir2: a: Copies a specified directory and contains all its files and subdirectories.
X: the format of this file is the same as that of the destination sector.
Q33 how to move files
A: mv/test1/file1/test2/file2: copy the file1 file under the test1 directory to the test2 directory and change it to file2.
Mv file1 file2 change the file name file1 to file2
Q34 how to find files?
A: $ find ~ -Name "*. txt "-print example: Check the. txt file in home‑home‑and display $ find. -name "*. txt "-print $ find. -name "[A-Z] *"-print # Query files starting with an uppercase letter $ find/etc-name "host *"-print # Query files starting with a host $ find. -name "[a-zjw%a-z%%0--9%0--9%.txt"-print # query the txt file starting with two lower-case letters and two numbers $ find. -perm 755-print $ find. -perm-007-exec ls-l {}\; # check whether all files that can be read and written by users are the same as-perm 777 $ find. -type d-print $ find .! -Type d-print $ find. -type l-print $ find. -size + 000000c-print # Query files with a length greater than 1 MB $ find. -size 100c-print # Query files with a length of 100c $ find. -size + 10-print # Query files with a length of over 10 expired items (1 file = 512 bytes)
Q35 what are the compression and decompression commands?
A: function: archive files
Format: tar parameter archive file name file or directory
Note:
A group of files is suffixed with tar.gz.
# Tar cvf backup.tar/etc
# Gzip-q backup.tar
Or
# Tar cvfz backup.tar.gz/etc/
Release a file suffixed with tar.gz.
# Gunzip backup.tar.gz
# Tar xvf backup.tar
Or
# Tar xvfz backup.tar.gz
Compress With one command
# Tar cvf-/etc/| gzip-qc> backup.tar.gz
Release with one command
# Gunzip-c backup.tar.gz | tar xvf-
Unbind the tar. Z File
# Tar xvfz backup.tar. Z
Or
# Uncompress backup.tar. Z
# Tar xvf backup.tar
Unbind the. tgz File
# Gunzip backup. tgz
Compress and decompress the. bz2 package
# Bzip2/etc/smb. conf
This will compress the smb.confinto smb.conf.bz2
# Bunzip2/etc/smb.conf.bz2
In this case, smb.conf.bz2 will be restored to smb. conf in the current directory.
Note:. bz2 compression format is not very common, you can use man bzip2
Q36 how to display system environment variables?
A: env command
Function: displays environment variables.
Format: env
Note:
Display current environment
Env
Assume that there is a corner of my_job used for the current location of the Environment Variable LANG.
Use the env command to execute the my_job file without modifying the LANG variable, as shown below:
Env PATH =/u/testuser/jobs: $ my_job
LANG = C
After the LANG value is modified in the env command, the following values are displayed:
Env LANG = C ++ PATH =/u/testuser/jobs: $ PATH my_job
LANG = C ++
Q37 what are the three command modes of VI?
A: vi is an editor in Linux. Its usage and interface are very similar to those on Unix platforms.
Basically, vi can be divided into three states: command mode, Insert mode, and last line mode. The functions of each mode are as follows:
1) command Line mode)
Controls the movement of the screen cursor, the deletion of characters, words, or rows, the movement of copying a segment and entering the Insert mode, or to the last line mode.
2) Insert mode)
You can enter text only in Insert mode. Press ESC to return to command line mode.
3) Baseline mode)
Save the file or exit vi. You can also set the editing environment, such as searching strings and listing row numbers ...... .
However, we generally simplify vi into two modes in use, that is, the last line mode is also included in the command line mode ).
Q38 vi basic operations
A: a) Go to vi
After the system prompts you to enter the vi and file name, you will be taken to the vi full screen editing screen:
$ Vi myfile
Note that after entering vi, you are in command mode. You must switch to Insert mode to Enter text.
B) switch to Insert mode to edit the file
Click "I" under "command mode" to enter "Insert mode". Then, you can enter the text.
C) Insert switchover
You are currently in "Insert mode", and you can only enter text all the time. If you find that you have entered an error! To move the word back with the light mark key, you must first Press ESC to switch to command mode and then delete the text.
D) Exit vi and save the file
Under "command mode", click ":" colon to enter "Last line mode". For example:
: W filename (enter "w filename" to save the article with the specified filename)
: Wq (enter "wq" to save the disk and exit vi)
: Q! (Enter q !, Force exit vi without saving the disk)
Q39 command mode function key
A: 1). insert mode
Press "I" to switch to the insert mode "insert mode". Press "I" to enter the insert mode. The input file starts from the current position of the cursor;
After you press "a" to enter the insert mode, the text is entered starting from the next position where the cursor is currently located;
After you press "o" to enter the insert mode, a new row is inserted and text is entered from the beginning of the line.
2) switch from insert mode to Command Line Mode
Press ESC.
3) move the cursor
Vi can be moved up, down, left, and right directly with the cursor on the keyboard, but the regular vi uses lowercase letters "h", "j", "k", and "l 」, the cursor is controlled to move one cell to the left, down, up, and right respectively.
Press ctrl + B to move the screen to the back.
Press ctrl + f to move the screen to the front.
Press ctrl + u to move the screen to the back half of the page.
Press ctrl + d to move the screen half to the front.
Press the number "0": to move to the beginning of the article.
Press G to move to the end of the article.
Press "$" to move to the end of the row where the cursor is located ".
Press ^ to move the cursor to the beginning of the row"
Press w to jump to the beginning of the next word
Press "e": move the cursor to the end of the next word
Press "B": the cursor returns to the beginning of the previous word
Press # l to move the cursor to the # position of the row, such as 5l and 56l.
4). delete text
"X": each time you press the button, the "Next" character of the cursor is deleted.
"# X": for example, "6x" indicates deleting the "Next" 6 Characters of the cursor position.
"X": uppercase X. Each time you press it, the "front" character of the cursor is deleted.
"# X": for example, "20X" indicates the position where the cursor is located, which is a string of 20 characters.
Dd: Delete the row where the cursor is located.
「 # Dd 」: delete from the row where the cursor is located # Row
5). Copy
"Yw": copy the character at the end of the cursor to the buffer zone.
# Yw: Copy # words to the buffer zone
"Yy": copy the row where the cursor is located to the buffer zone.
"# Yy": for example, "6yy" indicates copying 6 lines of text from the row where the cursor is located "down.
P: place the characters in the buffer to the cursor position. Note: All copy commands related to "y" must work with "p" to complete the copy and paste function.
6). Replace
"R": Replace the character at the cursor position.
"R": Replace the character wherever the cursor goes until you press the "ESC" key.
7). Reply to the previous operation
"U": If you mistakenly execute a command, you can immediately press "u" to return to the previous operation. You can perform multiple replies Based on Multiple "u" requests.
8). Change
"Cw": change the word at the cursor to the ending point.
"C # w": for example, "c3w" indicates that three words are changed.
9). Jump to the specified row
Ctrl + g lists the row numbers of the cursor.
"# G": for example, "15G" indicates moving the cursor to the first row of the article.
Q40 Shell usage
A: The program must start with the following line (the first line of the file must be located ):
#! /Bin/sh
Symbol #! The parameter used to tell the system that the program is used to execute the file. In this example, we use/bin/sh to execute the program.
When editing a script, you must make it executable if you want to execute it.
To make the script executable:
Chmod + x filename
Then, you can run your script by entering:./filename.
Note
During shell programming, a sentence starting with # represents a comment until the end of this line.
Variable
You must use variables in other programming languages. In shell programming, all variables are composed of strings, and you do not need to declare variables. To assign a value to a variable, you can write as follows:
Variable name = Value
You can add a dollar sign ($) before the variable to retrieve the variable value:
#! /Bin/sh
# Assign values to variables:
A = "hello world"
# Print the content of variable:
Echo "A is :"
Echo $
Enter the preceding content in your editor and save it as a file first. Then run chmod + x first
Make it executable, and enter./first to execute the script.
This script will output:
A is:
Q41 what is a regular expression?
A: Simply put, wildcards are used in the file name.
Q42 how do I change the IP address of a network interface?
A: Use the ifconfig command.
Q43 what are the two levels of SSH work?
A: The first level (password-based security verification) allows you to log on to the remote host as long as you know your account and password. All transmitted data is encrypted, but it cannot be guaranteed that the server you are connecting to is the server you want to connect. Other servers may pretend to be real servers, that is, being attacked by man-in-the-middle.
The second level (key-based security verification) depends on the key, that is, you must create a pair of keys for yourself and put the public key on the server to be accessed. If you want to connect to the SSH server, the client software will send a request to the server, requesting your key for security verification. After receiving the request, the server first looks for your public key in the home directory of the server, and then compares it with the public key you sent. If the two keys are consistent, the server uses the public key to encrypt the challenge and send it to the client software. After the client software receives a question, it can use your private key to decrypt it and then send it to the server.
Q44 what is the working principle of Telnet?
A: When you use Telnet to log on to the remote computer system, you actually start two programs: one is the Telnet client program, which runs on your local machine; the other is the Telnet server program, it runs on the remote computer you want to log on. The customer program on the local machine must complete the following functions: 1. Establish a TCP connection with the server; 2. Receive the characters you entered from the keyboard; 3. Convert the string you entered into a standard format and send it to the remote server; 4. Receive the output information from the remote server; 5. display the information on your screen.
Q45 what are common ftp commands?
A:
1! [Cmd [args]: Execute the interactive shell on the local machine and exit to return to the ftp environment, for example :! Ls *. zip.
2. $ macro-ame [args]: Execute macro to define macro-name.
3. account [password]: Provide the supplemental password required to access system resources after logging on to the remote system.
4. append local-file [remote-file]: append the local file to the remote system host. If the remote system file name is not specified, the local file name is used.
5. ascii: Use the ascii type transmission method.
6. bell: after each command is executed, the computer rings once.
7. bin: Binary File Transfer Mode.
8. bye: exit the ftp session.
9. case: when using mget, convert uppercase letters in the remote host file name to lowercase letters.
10. cd remote-dir: Enter the remote host directory.
11. cdup: Enter the parent directory of the remote host directory.
12. chmod mode file-name: Set the file-name access mode of the remote host file to mode, for example, chmod 777 a. out.
13. close: interrupt the ftp session with the remote server (corresponding to open ).
14. cr: When a file is transmitted using asscii, the carriage return line is converted into a return line.
15. delete remote-file: delete remote host files.
16. debug [debug-value]: sets the debugging mode. Each Command sent to the remote host is displayed, for example, deb up 3. If it is set to 0, the debug is canceled.
17. dir [remote-dir] [local-file]: displays the remote host directory and saves the result to the local file.
18. disconnection: Same as close.
19. form format: sets the file transmission mode to format. The default mode is file.
20. get remote-file [local-file]: transfers the remote-file of the remote host to the local-file of the local hard disk.
Q46 URL. What components does a URI consist?
The URL format consists of the following three parts:
The first part is the protocol (or service mode );
The second part is the Host IP address (sometimes including the port number) that contains the resource );
The third part is the specific address of the host resource ., Such as directories and file names.
A URI consists of three parts:
The naming mechanism for accessing resources.
Host Name for storing resources.
The name of the resource, represented by the path.
Q47 how does one modify the maximum number of connections of Apache?
A: In httpd. conf, set:
MaxClients n
N is an integer that indicates the maximum number of connections. The value range is between 1 and 256. If you want apache to support more connections, you need to modify httpd in the source code. h file, change the defined HARD_SERVER_LIMIT value to a large value, and then compile.
Q48 CRON command functions and usage
A: cron command: execute A command cyclically. The at command can only be executed once, although it is a task plan command, which is the difference between the two commands. The cron Service provides the crontab command to set the cron service. The following are some parameters and descriptions of this command: crontab-u // sets the cron service of a user, generally, the root user needs this parameter when executing this command.
Crontab-l // list the details of a user's cron Service
Crontab-r // Delete the cron service of no user
Crontab-e // edit a user's cron Service
Q49 firewall Classification
A: Packet filtering
Application Proxy
Q50 PING command usage
A: Ping command common Parameter options
Ping IP-t
Run the Ping command on the IP address until the IP address is interrupted by Ctrl + C.
Ping IP-l 3000
The Data Length in the Ping command is 3000 bytes instead of the default 32 bytes.
Ping IP-n 300
Run the Ping command 300 times.
Q51 Netatart command usage
A: Netstat is used to display statistics related to IP, TCP, UDP, and ICMP protocols. It is generally used to check the network connection of each port on the local machine.
Some common netstat options
Netstat-s this option displays statistics for each protocol.
Netstat-Ce this option is used to display statistics about Ethernet. It lists items including the total number of bytes, number of errors, number of delimiters, number of datagram, and number of broadcasts. These statistics include both the number of sent and received data packets. This option can be used to calculate some basic network traffic ).
Netstat-r displays information about the route table, which is similar to the information shown later when the route print command is used. In addition to valid routes, valid connections are also displayed.
Netstat-a this option displays a list of all valid connection information, including the ESTABLISHED connections (ESTABLISHED) and those that listen to the LISTENING requests.
Netstat-n displays all established valid connections.
Q52 ifconfig command usage
A: ifconfig command
Used to view and change network interface addresses and Parameters
$ Ifconfig-
Lo0: flags = 849 mtu 8232
Inet 127.0.0.1 netmask ff000000
Hme0: flags = 863 mtu 1500
Inet 211.101.149.11 netmask ffffff00 broadcast 211.101.149.255
Ether 8: 0: 20: a7: 4d: 21
The system displays the network interface name, interface status (up or down ),
Interface IP address, mask, and other information
Change the IP address of the network interface:
# Ifconfig hme0 down
# Ifconfig hme0 211.101.149.233 netmask 255.255.255.0 up
First, use the down command parameter to temporarily stop the service of the network interface hme0, and then run the ifconfig command
The interface allocates a new IP address and mask, and starts the network interface service.
You can also change the IP address of the machine by changing the IP address value in the file/etc/hosts and restarting the system.
/Etc/hosts /:
211.101.149.11 sampdt
Define the host name in/etc/hostname. hme0 and IP address.
If the NIC is changed or the NIC is added, the interface service cannot be started automatically. You need to manually create the NIC service:
# Ifconfig hme0 plumb
You can create a network port service for the interface le0.
Correspondingly, the ifconfig with the unplumb parameter can be used to stop the service and disable the network.

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.