Article Title: Linux application Q &. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Q: How do I install software in RPM and other formats in Linux?
A: The RPM format is used as follows.
1. The installation code is as follows:
$ Rpm-ivh file name
2. Upgrade with the following code:
$ Rpm-Uvh file name
3. delete the file. The Code is as follows:
$ Rpm-e package name (note that it is not the file name used for installation)
4. Check the installed package. The Code is as follows:
$ Rpm-qa will list all installed rpm packages
5. view the package information. The Code is as follows:
$ Rpm-qpi package name
6. view the package File Installation content:
$ Rpm-qpl package name
In other words, the software package also has a certain format, such as .tar.gz format. The general steps are as follows:
$ Tar zxvf name.tar.gz
Expand the file and follow the installation documentation. When installing software with special functional requirements (such as MySQL and PHP)
You also need to compile it yourself, which is not detailed here.
Q: How can I get command help in Linux?
Answer: man and info can be used. Code for saving man information to a file:
$ Man command | col-B> saved file name
For example, save the command of cp.txt to the cp.txt file. The Code is as follows:
$ Man cp | col-B> cp.txt
Q: How to back up and package files?
Answer: 1. Use tar to package
You can use the following code to package the specified file (directory:
$ Tar cvf package name file (or directory) List
For example, you can pack the content of the/usr/local/vardirectory to var.tar as follows:
$ Tar cvf var.tar/usr/local/var
To view the file content in the package, use the following code:
$ Tar tvf var.tar columns the file content in var.tar.
To expand the package content, perform the following operations:
$ Tar xvf var.tar
When adding files to a prepared package, you can perform the following operations:
$ Tar rf package name list of files to be added
For example, add all the. SQL files under the current directory to var.tar, which can be implemented using the following code:
$ Tar rf var.tar *. SQL
2. Use gzip to package
To compress a file (for example, var.tar), run the following command:
$ Gzip var.tar
The package name is var.tar.gz.
Extract the following code:
$ Gzip-d var.tar.gz
Or:
$ Gunzip var.tar.gz
You can use gzip to extract and expand the compressed file. For example, to extract var.tar.gz and expand it to the current directory, run the following command:
$ Tar zxvf var.tar.gz
The z option indicates that gzip is called.
Q: How to configure Samba?
A: 1. Configure/etc/services. The Code is as follows:
$ Netbios-ns 137/tcp 137/udp
$ Netbios-dgm 138/tcp 138/udp
$ Netbios-ssn 139/tcp 139/udp
2. Configure smb. conf
The content of the/etc/smb. conf file is as follows:
[Global]
Workgroup = develop
# Set the working group to which the local machine belongs
Netbios name = server
# Set the display name of the local machine in the network neighbor
Server string = file server
# Set remarks
Security = user
# User-level security
[Public]
Comment = Public Stuff
Path =/home/Share
Browseable = yes
Guest OK = yes
Public = yes
Writable = yes
# Defines a shared directory. All users have read and write permissions on this directory.
Use chmod 0777/home/Share to modify the/home/Share access permission.
3. Add a user and set the password. The Code is as follows:
$ Smbpasswd-a username
4. Test. You can use the testparm command to parse and describe the smb. conf file
Content, which can detect configuration errors.
5. Restart Samba. The Code is as follows:
$/Etc/rc. d/init. d/smb restart
Q: How to configure the NIC in Linux?
A: For Red Hat Linux, use setup to set IP, NetMask, GW, and DNS in "network configuration.
You can also use the ifconfig command to set the netmask and IP addresses of the first Nic. The Code is as follows:
$ Ifconfig eth0 netmask 255.255.255.0 192.168.6.2
Q: How can I view the hard disk usage?
A: You can use the df command. The Code is as follows:
$ Df-m
M indicates that the usage of each partition is displayed by M. You can use du to view the space occupied by a directory. The Code is as follows:
$ Du-sm
You can also view the space occupied by the/usr directory (unit: MB). The Code is as follows:
$ Du-sm/usr
Q: How can I find files in Linux?
A: The following example describes how to find files in Linux.
1. Find the file named *. SQL in the current path. The Code is as follows:
$ Find.-name "*. SQL"
2. Search for files larger than MB. The Code is as follows:
$ Find.-size + 100000
The unit of the following number is KB.
3. Find the file containing the print, the Code is as follows:
$ Find.-name "*"-exec grep-l "print" {} 4. find and delete the tmp * file. The Code is as follows:
$ Find.-name "tmp *"-exec rm {} 5. Search for files that have not been modified within 7 days. The Code is as follows:
$ Find.-mtime + 7:
Q: How can I prevent objects from being deleted by mistake?
A: When rm is set to rm-I, a message is displayed when you delete it. Use the following code to protect files from accidental deletion:
$ Chattr + r file name
Q: How do I set the color?
A: Modify the $ HOME/. bashrc file and add the following code:
Alias ls = "ls -- color"
Use the following code to make the change take effect immediately:
$ Source. bashrc
Common color meanings in Linux are: blue indicates directory; Green indicates executable file; red indicates compressed file; light blue
Color indicates the link file; gray indicates other files.
Q: How to edit text in Linux?
A: The most common text editing tool is vim, which is installed by default in Linux. Vim is used as follows.
1. enable/disable the syntax color. The settings are as follows:
Syn on/syn off
2. Copy the content of the specified region
Copy to start: mk.
Copy to end: "ay 'k. At this time, the specified content has been pressed to buffer.
Copy to target: "ap. Paste the content of "a to the current position.
3. search and replace
Replace all abc files with d. The Code is as follows:
% S/abc/def
Replace the first line with 30 without the case sensitivity of abc. The Code is as follows:
1, 30 s/abc/def/I
4. Edit two files at the same time. The Code is as follows:
Vi file1 file2
Switch between two files with: n and: N.
5. move the cursor quickly
Use w and B to move a word forward/backward. use Ctrl + d and Ctrl + u to flip the front half of the page.
In addition, you can install some Office tools to edit files.
The following are two software compatible with the MS Office format:
StarOffice http: // freesoft. online.sh.cn/mirrors/StarOffice/
Wenjie http://www.haansoft .com.cn/
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.