Summary of the basic operations of Linux, basic operations of linux

Source: Internet
Author: User

Summary of the basic operations of Linux, basic operations of linux

Preface

Linux was a UNIX-compatible operating system developed in 1991 and can be used for free. Its source code can be freely transmitted and can be modified, enriched, and developed by anyone, the original intention of developers is to jointly create a perfect, ideal and free-to-use operating system.

The purpose of this summary is to popularize basic Linux knowledge among the students and make a good start for us to learn more about Linux in the future.

Part 1 Linux Basics

In this section, we will take a look at the overview of Linux and have a preliminary understanding of Linux.

1. What is Linux?

Linux is an Intel-series CPU (CYRIX, amd cpu can also be used) as a hardware platform. It is a completely free UNIX-compatible system and is fully applicable to individual PCs. It is itself a complete 32-bit multi-user multitasking operating system, so do not need to install DOS or other operating systems first (MS Windows, OS2, MINIX ..) you can install it directly. Linux was first originated in October 5, 1991 by a Finnish college student Linux Torvalds (Torvalds@kruuna.helsinki.fi) wrote the Linux core program version 0.02, however, the subsequent development was almost completed by the Linux Community (Linux Community) on the Internet. Linux does not belong to any company or individual. Anyone can obtain or modify its source code for free ). Most of the software on Linux is developed by GNU, so the software is usually freely spread when it is attached to the GNU Public License (GPL. GPL is a type of license that allows you to obtain free software for free, so Linux users' usage activities are basically unrestricted (as long as you do not use it for commercial purposes ), instead of having to pay a high price for full licenses as Microsoft products use, it is subject to the number of system installations.

Ii. What are the benefits of installing Linux?

Linux's core features incomparable stability and efficiency in Windows. Without using X Windows, it occupies less system resources and can make an Intel486 become an efficient Workstation. Most importantly, Linux has a recognized C language, the world's best compiler gcc. If you want to get a more efficient development environment (not necessarily the most friendly, but it must be the most powerful). I suggest you be familiar with Linux.

3. How to Get Linux?

We recommend that you download it directly on the corresponding official website.

Part 2 Linux Basics

After some explanations above, I think the students should have a preliminary perceptual knowledge of Linux, but our understanding is only on the surface that still needs to be improved. Through this study, students will have a further understanding of the Linux architecture, basic operations, and basic functions.

I. Linux File System Structure

The file system in Linux is very different from the file system in MS-Windows. I will not talk about the file structure in Microsoft Windows. We will mainly discuss the structure of the file system in linux. linux has only one file tree, and the entire file system starts with a root "/". All files and external devices are mounted to this file tree as files, including hard disks, floppy disk, optical drive, and modem, which are quite different from the MS-Windows System Based on the drive letter. the file structure of Linux reflects the concise analysis settings of the operating system. The root directories of the linux Release versions that we can often access are mostly the following:

/Bin/lost + found/sbin/var/boot/root/home/mnt/tmp/dev/lib/proc

/Usr

Now I will give you a brief introduction to these directories:

1./bin and/sbin

Most basic programs for using and maintaining UNIX and Linux systems are included in/bin and/sbin. the fame of these two directories includes bin, this is because all executable programs are binary files ).

1) The/bin directory is usually used to store the most commonly used basic programs, such:

Login Shells file operation utility system utility compression Tool

2) The/sbin directory usually stores basic system and system maintenance programs, such:

Fsck fdisk shutdown

Lilo init

The main difference between programs stored in these two directories is that programs in/sbin can only be executed by the root (administrator.

2./etc

This directory is generally used to store the configuration files of the entire file system required by the program. Some important files are as follows:

Passwd shadow hosts motd profile shells services lilo. conf

3./lost + found

This directory is used to store the "Wandering" files that do not know where to recover after the system restarts the system after an abnormal crash.

4./boot

This directory stores various files related to system startup, including the system boot program and core components.

5./root

This is the main directory of the system administrator (root.

6./home

The home directories of all users in the system are stored in/home, which contains the home directories of actual users (persons) and those of other users. linux differs from UNIX in that the root user's main directory of Linux is usually in/root or/home/root, while UNIX is usually in /.

7./mnt

As agreed, removable media such as CD-ROM, floppy disk, zipdisk, or Jaz should be installed in the/mnt directory, the/mnt directory usually contains subdirectories, each subdirectory is an installation point for a specific device type. For example:

/Cdrom/floppy/zip

/Win

If we want to use these specific devices, we need to use the mount command to mount the external devices from the/dev directory. Here you may see a win Directory, which is a mount point on my machine to the windows file system, in this way, I can access my files under windows by accessing this directory. However, if your windows File System is in the NTFS format, this method will not work.

8./tmp and/var

These two directories are used to store temporary files and files that are frequently changed.

9./dev

This is a very important Directory, which stores image files of various external devices, some of which should be kept in mind. For example, the name of the first floppy disk drive is fd0, the name of the first hard disk is hda, the first partition in the hard disk is hda1, and the second partition is hda2; the first optical drive is hdc. In addition, the modem and other peripherals are used. Among the many names, we only need to remember the most common peripherals.

10./usr

As agreed, this directory is used to store programs or files directly related to the users of the system. The main directory of each system user is relative to their small "/".

11./proc

The contents under this directory are the virtual images of processes currently running in the system. here we can see some directories composed of the currently running process numbers, there is also a kernel file that records the content of the current memory.

In my personal experience, I think these directories and what should be stored under them should all be well written, which is very helpful for us to further use the system.

Ii. File Type

I would like to introduce the basic operation commands here, but many of these commands involve the file type, so I have to first introduce the file type.

Linux file types can be roughly divided into five categories, and it supports long file names, whether it is a file or directory name, can reach up to 256 bytes. If you can use 128 Chinese characters to write a small composition, you can also use it to make a file name (of course, there cannot be unspecified name characters ).

1. General Files

General files, such as plain text file mtv-0.0b4.README, setup file lilo. conf, record file ftp. log and so on are all. Generally, files of the type do not have any color displayed on the console. The default color is white.

2. Directory

I will not explain what the directory means. My task is to tell you that you can use the cd + directory name to enter this directory, the color of the Directory displayed on the console is blue, which is very easy to identify. If you use ls-l to watch them, you will find that one character of their file attributes (a total of 10 characters) is d, which indicates that it is a directory rather than other things.

III. Basic Linux operating commands

First, we will introduce the term "console", which is a commonly seen man-machine interface using character operation interfaces, such as dos. The console command is a command that can be run on the operating system through the character interface. For example, the doscommand is a console command. What we need to know now is the basic Console Commands based on the Linux operating system.

Note that, unlike the doscommand, Linux commands (including file names and so on) are case sensitive. That is to say, if the command you entered is case insensitive, the system will not respond as expected.

1. ls

This command is equivalent to the dir command under dos. It must be the first one I will introduce. It is also one of the most important commands in Linux console commands. The most common parameters of ls include-a-l-F.

Ls-

Linux Files. files starting with ls are regarded as hidden files and cannot be seen only by using ls commands. In addition to displaying common file names, ls-a can also display hidden files.

Ls-l (this parameter is the lowercase letter of L, not the number 1)

This command can display the file content in a long format. If you need to view more detailed file information, you need to use the ls-l command. For example, if I Type ls-l in a directory, the following information may be displayed (the top two rows are added by myself ):

Location 1 2 3 4 5 6 7

File Attribute file number the group file size to which the owner belongs file name creation date

Drwx ------ 2 Guest users 1024 Nov 21 Mail

-Rwx -- x 1 root 89080 Nov 7 tar *

-Rwxr-xr-x 1 root bin 5013 Aug 15 9:32 uname *

Lrwxrwxrwx 1 root 4 Nov 24 :30 zcat-> gzip

-Rwxr-xr-x 1 root bin 308364 Nov 29 7:43 zsh *

-Rwsr-x --- 1 root bin 9853 Aug 15 su *

Next, I will explain the meaning of the displayed content.

A) the first column indicates the attributes of the file.

Linux Files are basically divided into three attributes: readable (r), writable (w), and executable (x ). However, there are ten grids that can be added here (10 bits are actually implemented in a specific program ).

The first cell is a special cell, indicating a directory or a link file, etc. d indicates a directory, such as drwx --; l indicates a link file, such as lrwxrwxrwx; if it is a horizontal, indicates that this is a file. The remaining grids are in the unit of 3. Because Linux is a multi-user multi-task system, a file may be used by many people at the same time, so we must set the permissions for each file, the permission positions of the files are arranged in the following order (-rwxr-xr-x is used as an example ):

Rwx (Owner) r-x (Group) r-x (Other)

In this example, the permissions are as follows: users are readable, writable, and executable; users in the same group are readable, writable, and executable; other users are readable, writable, and executable. In addition, the execution of some program properties is not X, but S, which indicates that the user who executes the program can temporarily execute the program with the same power as the owner. Generally, commands or programs such as System Management enable the user to have the root identity during execution.

B) the second column indicates the number of files.

If it is a file, the number is naturally 1. If it is a directory, the number is the number of files in the directory.

C) The third column indicates the owner of the file or directory.

If the user is currently in his/her Home, this column is probably the name of his/her account.

D) The fourth column indicates the group to which the device belongs ).

Each user can have more than one group, but most users should belong to only one group. Only when the system administrator wants to grant special permissions to a user, to another group.

E) The fifth column indicates the file size.

The file size is represented by byte, while the empty directory is usually 1024 bytes. Of course, you can use other parameters to make the file display unit different, for example, if ls-k is used, the size unit of a file is displayed in kb. However, we generally use byte as the main unit.

F) The sixth column indicates the creation date.

In the format of "month, day, and time", for example, Aug 15 indicates on January 1, August 15.

H) The seventh column indicates the file name.

We can use ls-a to display hidden file names.

Ls-F (Note: F is in upper case)

This parameter is used to add symbols of the file type after a file. For example, * Indicates executable,/indicates directory, and @ indicates link file, this is because the-F parameter is used. But now, basically all Linux releases have built-in the-F parameter for ls. That is to say, we can see all kinds of resolution symbols without entering this parameter.

2. cd command

This command is used to access the directory. It is used in the same way as in dos, so I think there is nothing to say, but there are two points to add.

First of all, unlike dos, Linux directories are case-sensitive. If case-insensitive, your cd operation will fail.

Second, if you enter cd directly without adding anything to it, it will return to the user's Home Directory. If it is root, it is returned to/root. This function is the same as cd ~ Is the same.

3. mkdir, rmdir command

The mkdir command is used to create a new directory. The rmdir command is used to delete the directory to be created. The functions of these two commands are no longer described. They are basically the same as those of the md and rd commands in dos.

4. cp command

This command is equivalent to the copy command below dos. The specific usage is: cp-r source file (source) target file (target)

The parameter r is used to copy data together with sub-directories in the Metafile. Readers familiar with dos may find it easier to use this command. After all, they need to press the keyboard twice less than below dos.

5. rm command

This command is used to delete files. It is different from the rm (delete an empty directory) in dos. Common Parameters of the Rm command include-I,-r, and-f.

For example, I want to delete an object named text:

Rm-I test

The system will ask us: "rm: remove 'test' y". After you press enter, the file will be deleted. This is because linux does not have undelete commands like dos, or it can use tools such as pctool to save deleted files, files deleted in linux cannot be recovered. Therefore, it is necessary to use this parameter before deletion.

Rm-r directory name

This operation can be deleted along with the subdirectories under this Directory, which is similar to rmdir.

Rm-f file name (directory name)

This operation can be forcibly deleted.

6. mv command

The function of this command is to move a directory or file. The extended function is to rename a directory or file. Its usage is basically the same as the move in dos. When you use this command to move a directory, it will be removed along with the subdirectories under the directory. In addition, because there is no rename Command in linux, you can use the following method to rename a file or directory:

Original mv file (directory) Name new file (directory) Name

7. du, df command

The du command displays the disk space occupied by the current directory, and the df command displays the remaining disk space of the current disk.

If the du command does not add any parameters, the returned information is the usage of the entire disk. If a directory is added to it, this is the usage of the directory on the disk (this function is not available in dos ). However, I generally do not like to use du because it provides too much information. I don't think so. I am the most commonly used df command, because the amount of space left on the disk is very important to me.

8. cat command

This command is a very important command in linux. Its function is to display or link common ascii text files. Cat is short for concatenate, similar to the type command under dos. Its usage is as follows: cat text displays the text file

Cat file1 file2 displays file1 and file2 in sequence

Cat file1 file2> file3 combines the content of file1 and file2, and then "redirects (>)" to the file3 file.

">" Is a very interesting symbol. It means to redirect to the right, that is, to treat the result on the left as an input and then input it to the file file3. Note that file3 is a file that has not existed before redirection. If file3 is an existing file, its content is overwritten and changed to file1 + file2.

If there is no file name on the left, and there is a file name on the right, for example:

Cat> file1

The result is a blank line. Wait for you to enter the text, and then press [Ctrl] + [c] or [Ctrl] + [d]. the editing is completed and the file file1 is generated. The content of file1 is the content you just entered. The result of this process is the same as that of copy con file1 in dos.

In addition, if you use the following command:

Cat file1> file2

This will change to "appending" the content of file1 to the end of file2, while the content of file2 still exists. This type of redirection character> is more commonly used and can be used more.

9. more, less command

These are two commands for displaying common text files.

If a text file is too long to display more than one screen, it is not ideal to use cat, you can try the more and less commands. The More command can temporarily hold a file with More than one page on the screen. It will not be displayed until you press any key. In addition to more functions, less can also be used to scroll up or down the network by using the direction keys. Therefore, when you read articles, less is a good choice.

10. clear command

This command is used to clear the screen. It does not require any parameters. It has the same function as the clr in dos. If you think the screen is too messy, you can use it to clear information on the screen.

11. pwd command

The purpose of this command is to display the current working path of the user. This command does not need to be said.

12. ln command

This is another very important command in linux. Please be familiar with it. Its function is to create a non-same link for a file in another location. The most common parameter of this command is-s. Its usage is as follows:

Ln-s source file target file

When we need to use the same file in different directories, we do not need to put a file that must be the same under each required directory. We only need to put it in a fixed directory, put the file, and then use the ln command link in other directories to link it, without occupying disk space repeatedly. Example: ln-s/bin/less/usr/local/bin/less

-S indicates the symbol (symbolic.

There are two points to note: first, the ln command will keep the synchronization of each link file, that is, no matter which one you change, other files will change the same; second, there are two types of ln links: Soft link and hard link. The soft link is ln-s *. It will only generate a file image at the position you selected, and will not occupy disk space, hard link ln *, without the parameter-s, it will generate a file of the same size as the source file at the position you selected, whether it is a soft link or a hard link, all files are synchronized.

If you use ls to view a directory, you will find that some files are followed by a @ symbol, that is, a file generated using ln command, and you can use ls-l command to view it, the link path is displayed.

13. man command

If your English is good enough, you can be proficient in linux without relying on anyone, as long as you use man. Man is actually the help of command usage. The most important thing to learn about any UNIX operating system is to learn to use man's Auxiliary Command. Man is the abbreviation of manual (manual). Its description is very detailed, but it seems a headache because it is both in English. It is recommended that you go to man again when you need it. Normally, remember some basic usage.

14. logout command

At first glance, we can see that this is the command to exit the system. I will not say much about it. It should be emphasized that linux is a multi-user, multi-process operating system, so if you don't need it, you can quit the system. You don't have to worry about shutting down the system, that is the case for the system administrator. But remember, even if you use linux on a single machine, logout cannot be shut down directly, because it is not a command to shut down.

15. Mount command

This is the most frequently asked question for Linux beginners. Since everyone is used to Microsoft's access method, I always want to use a similar idea to find a floppy disk and a CD. However, in Linux, UNIX treats devices as files. To access a floppy disk and a CD, you must first load them to the/mnt directory of the Linux system.

The mount command is run in the following format: mount-t file system type device name mount directory file system type is the partition format, Linux supports many file system types:

Msdos partition file system type vfat supports DOS partition files with long file names (which can be understood as Windows files) file system type of the iso9660 disc ext2 Linux File System Type

......

Device Name: the name of the device you want to load. The floppy disk is usually/dev/fd0 fd1. The disk is determined based on the position of your optical drive. The disk where the optical drive is usually mounted to the master disk of the second hard disk is/dev/hdc; if a DOS partition is accessed, the device names are listed. For example,/dev/hda1 indicates the first partition of the first hard disk. The Mount directory is the load point of the specified device.

4. Basic System Management commands

System management can be basically divided into two types. One is the system management part of linux by the root (System Administrator). The root is responsible for the stability of the entire linux system, increase system security, verify user identities, add or delete malicious users, and clarify the user permissions on each machine. The other is the permission management for each user (including root) on their own files. Because linux is a multi-user multi-task system, every user may put the content of their work or some confidential files on the Linux workstation, so the ownership and right to use each file or directory, there must be very clear regulations. The following describes basic system management commands by Administrator and general user.

System Management commands used by administrators

Adduser command

Add a user account command. If you want to add a user named jack, enter:

Adduser jack

In this way, a user named jazk is added. It is case sensitive. In addition, the new user does not have a password. You should also set a password for the user or instruct the user to set a password when logging on to the system for the first time. Passwd command

This command can modify the password of a specific user in the following format:

Passwd User Name

The system will prompt you to enter the new password. After you enter the new password for the first time, enter the new password for the second time for confirmation. After you enter the same password twice, the system accepts the new password. If this command is used by a common user, you can only change its own password. Find, whereis, locate command

These three commands are used to find files. The format is:

Find path name-name file name parameter (we will not discuss the parameter here)

Whereis file name

Locate file name

In general, the find command is the most powerful, but the hardware loss is also the biggest. When you use find to find your file, you will find that the hard disk is constantly flashing, this means that your hard disk may be less than others in year 34. When you use whereis or locate to search for files, you will find that the hard disk is secure, because these two commands are used to search for files from the system database, rather than trying to read the hard disk. Therefore, if you only want to find some laughter files, you can use whereis or locate. If you want to manage the system, then you can use find and add some parameters to meet your requirements. Su command

This command enables normal users to become super users with administrator permissions, as long as they know the Administrator's password. One of the priorities of multi-user multi-task systems is system security. Therefore, you should avoid using the root identity to log on to the system for some routine operations, because the root password may be known for a long time and endanger system security. Therefore, do not Log On As root. Even if you want to manage the system, try to use the su command to temporarily manage the system, and remember to change the root password periodically.

Now you are logged on to the system as a common user. Now you enter su.

The system requires you to enter the administrator password. After you enter the correct password, you can obtain all administrator permissions. This is the superuser ). However, after you perform various management operations, you only need to enter the logout to return the status of the original normal user. Shutdown, halt command

These two commands are used to shut down the linux operating system.

As I mentioned earlier, as a common user, the system cannot be shut down at will, because although you have used up the machine, other users may be using the system at this time. Therefore, only Administrators can shut down the system or restart the system. In addition, the linux system uses some memory as the Cache during execution. If the data in the memory is not written to the hard disk, the power is unplugged and the data in the memory is lost, if the data is related to the system itself, it will cause great harm to the system. Generally, we recommend that you run the sync command three times before shutdown. You can use semicolons (;) to merge the commands for execution. For example:

# Sync; sync

When you use shutdown to shut down the system, the following formats are available:

Shutdown (the system has built-in shutdown for 2 minutes and sends some messages to the user in use)

Shutdown-h now (the system shuts down immediately after this command is executed)

Shutdown-r now (after this command is run, the system immediately restarts, equivalent to reboot)

Shutdown-h 20:25 (the system will shut down at 20:25 today)

Shutdown-h + 10 (the system will shut down in 10 minutes)

If you want to transmit the information to the user on the machine before shutting down, you can add the "-q" parameter to output the built-in shutdown information of the system to the user and notify them to go offline.

The halt command is unnecessary. As long as you input halt, the system will start to close the process. The effect is exactly the same as that of shutdown-h now. I use halt every time I shut down the system. Reboot Command

Once you read this word, you will know that this command is used to restart the system.

After you enter reboot, you will see that the system is shutting down services one by one, then shut down the file system and hardware, and then the machine starts to re-check and reboot, go to the linux system again.

System Management commands used by common users

Chown command

This command is used to change the file owner.

If you have a file named classment. if the ownership of a list file is to be granted to golden, chown can be used to perform this operation. However, after you change the file owner, although the file is in your Home directory, you have no permission to modify or delete the file. This command is usually used when you want a user on a linux machine to go to your Home to create a file. However, when you use this command, you must be clear about it. Chmod command

This command is used to change the attributes of directories or files. It is a familiar command in linux.

There are many ways to use this command. For space reasons, I only use one of the most commonly used methods. As mentioned above, a file uses 10 small cells to record the permissions of the file. The first three cells are the permissions of the owner (user), and the third cell is the permissions of members in the same group as the user, the last three cells indicate the permissions of other users (other. Now we use a three-digit binary number to represent the corresponding three cell permissions, for example:

111 rwx 101 r-x 011-wx 001-x 100 r-

In this way, we can use three decimal numbers to represent the ten cells in the attribute bits of a file. The size of each decimal number is equal to the three-digit binary number of each three cells. For example, if the attribute of a file is rwxr-r-, we can use 744 to represent its permission attribute; if the attribute of a file is rwxrwxr -, the corresponding three decimal numbers are 774. In this way, we can use this simple method to specify the attributes of a file. For example, I want to put a file named test. if the list attribute is set to rwxr-x-, I only need to execute: chmod 750 test. you can use ls-l to view the changed permissions.

5. Instructions on Process Processing

Ps

Ps is used to display the current status of your process or system processes.

Common parameters are listed below:

The options are described as follows:

-A lists the process conditions including other users.

-U displays the process status of user-oriented.

-X displays the process status without terminal control.

-W uses a wide display mode to display the process status.

We can obtain the current processes status through ps, such as pid and running state. Kill

The purpose of the kill command is to send a signal to a process. Because most of the messages are sent to kill the SIGKILL or SIGHUP of the process, they are called kill. Kill usage

Is:

Kill [-SIGNAL] pid...

Kill-l

SIGNAL is a singal number ranging from 0 to 31, where 9 is SIGKILL, which is generally used to kill signals that cannot be normally terminate. For the usage of the remaining signals, refer to the description of signal in sigvec (2. You can also use kill-l to view the number that can replace signal. For more information about kill, see man kill.

6. Instructions on string processing

Echo

Echo is used to display a string on the terminal. □Echo-n indicates that there is no hop after the display. Grep/fgrep

Grep is a filter. It can filter rows with a certain string from one or more files, or filter rows with a certain string from standard input.

Fgrep can store a group of strings to be filtered in a file, and then use fgrep to filter out rows containing strings belonging to this group.

The usage of grep and fgrep is as follows:

Grep [-nv] match_pattern file1 file2 ....

Fgrep [-nv]-f pattern_file file1 file2...

-N: Add a row number to the row.

-V: List rows that do not contain match_pattern.

Match_pattern

-F stores the string to be searched with pattern_file

7. Instructions for querying status on the network

Man

Man means manual. UNIX provides online assistance (on-line help). man is used to query commands, system calls, standard library scripts, and various tables during use. Man is used as follows:

Man [-M path] [[section] title]...

Man [-M path]-k keyword...

-M path the manual database path required by man.

We can also replace the-M option by setting the environment variable MANPATH.

Title: This is the object to be queried.

Section is a number that indicates the classification of manual. Generally, 1 indicates executable commands, 2 indicates system call, 3 indicates standard functions, and so on.

If we want to refer to eqnchar (7), we can enter man 7 eqnchar to obtain the auxiliary information we want.

-K keyword

Used to list the title containing this keyword.

Man is a very important command on UNIX. The usage described in this handout is only a common usage and simple description, please use man for detailed usage and instructions. Who

The who command is used to query who are currently online. W

The w command is used to query the current jobs of those online users. Ku

Ku can be used to search for users on the entire network. Unlike w and who, ku only queries local hosts. It also allows users to create a search for a specific user list. You can create an archive information-file to store the information of your friends in a column, and then create an archive hosts-file to specify the name of the machine to be searched. The Command Format of ku can be obtained by ku-h.

Part 3 network services in Linux, configuration problems and common tools

In this section, I will show you some typical network services that can be provided in Linux. You will have a perceptual knowledge of these services, in addition, we will also see some important configuration files and their usage in Linux. Finally, we will see the most commonly used tool software in Linux.

I. Network Services in Linux

In addition to basic connection functions such as telnet, ftp, rsh, login, and finger, the network functions of Linux fully leverage the functions of various servers, next I will introduce a network service in Linux.

Samba

Nowadays, Samba is very important for the rapid growth of Linux, which greatly expands the application field of Linux. Samba can provide services that convert SMB (an information format used by windows) and NFS (an information format used by Linux, the workstation running Windows can communicate with the server running Linux, and allow users on the network (including Windows users) to share a printer, in this way, the Linux server can run in a Windows environment. In addition, our data server uses samba.

Ii. common tools and software in Linux

Here I will introduce the most common tools and software in the Linux world, including vi, tar, gzip, and rpm.

Text editing

Vi is the most powerful text editing tool in the Linux (UNIX) World. I mentioned it in my first lecture. Now I will introduce some basic usage methods of vi to you.

We recommend that you use Baidu for basic operations on vi.

Compression Tool

Tar and gzip usage

1) archive a group of files with the suffix tar.gz.

# Tar cvf backup.tar/etc

# Gzip-q backup.tar

Or

# Tar cvfz backup.tar.gz/etc

2) release a file suffixed with tar.gz.

# Gunzip backup.tar.gz

# Tar xvf backup.tar

Or

# Tar xvfz backup.tar.gz

3) Compress With one command

# Tar cvf-/etc/| gzip-qc> backup.tar.gz

4) run a command to release the instance.

Gunzip-c backup.tar.gz | tar xvf-

5) How to unbind the tar. Z file?

# Tar xvfz backup.tar. Z

Or

Uncompress backup.tar. Z

# Tar xvf backup.tar

6) How to unbind the. tgz file?

# Gunzip backup. tgz

7) How to 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

Installation Tools

RPM is a software Package Installation tool launched by the world-famous Red Hat company. It is called Redhat Package Manager. The emergence of RPM provides a new method for installing software packages, which is more convenient than Microsoft's Windows. Next I will introduce the basic usage of RPM.

1) install a package

# Rpm-ivh <rpm package name>

2) upgrade a package

# Rpm-Uvh <rpm package name>

3) Remove a package

Rpm-e <rpm package name>

4) installation parameters

-Force installation even if it overwrites files belonging to other packages

-Nodeps: If the RPM package is installed on another package, it is forced to install the RPM package even if it is not installed.

5) check whether a package is installed.

# Rpm-q <rpm package name>

6) obtain the installed package information.

# Rpm-qi <rpm package name>

7) list the files in the package

# Rpm-ql <rpm package name>

8) list the RPM packages of a file on the server.

# Rpm-qf file name

9) can be used together with several parameters

# Rpm-qil <rpm package name>

10) list all installed rpm packages

# Rpm-qa <rpm package name>

Slogan

At this point, the basic training of Linux is almost over. I hope you can start to pay enough attention to this operating system and get a great harvest in the Linux World. Our training program can only serve as an example. We hope that you will continue to enrich your strength in your future studies and become a "Hardcore" Linux master as soon as possible.

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.