Charm of a command

Source: Internet
Author: User
The charm of a command-general Linux technology-Linux programming and kernel information. The following is a detailed description. Create an archive file

Tar-czpf folder_name.tar.gz folder_name

This command creates folder_name as the folder_name.tar.gz archive file.

Recursively search for strings in a file

Find./-name '*. html'-exec grep "breadcrumbs. inc. php" '{}' \;-print

This command will search for all HTML files containing breadcrumbs. inc. php.

Search and replace the content in the file

Sed-I's/B/strong/G' index.html

This command searches for B in the index.html file and replaces it with strong.

View the disk usage of the Directory

Du-h -- max-depth = 1 | sort-n-r

View startup

First, check the/Etc/Syslog. conf file and find the corresponding file (for more information, see Man Syslogd, Man Syslog. conf, and Man klogd "). Generally, SlackWare is/Var/Adm/Messages, and Redhat is/Var/Log/Messages. These files may be large and must be backed up and deleted.

Use the Nohup command

If you want your process to be executed after exiting the system, you can use the Nohup command, for example:

% Nohup tar-cf/dev/tape/home &

If you log out and then log on again, run the 'ps' command to check that the process is still running.

Note: To put commands in the background for running, Nohup must be used together with & Operations; some software can handle Sighup signals themselves, such as Wget, so no Nohup is required for them.

If you are willing to use your brains, you can also use Nohup to implement PPP callback: first dial up and then execute a self-made script with Nohup, such as "Sleep 60; ppp-start-script and so on. Finally, log out and stop the call.

Run the program in the background

Some programs work very time-consuming. Add an & symbol next to it, such as "Updatedb &" and "Netscape. In this way, the Shell will be released for other work. Note that the parent process of the program is still the Shell. If you exit the Shell, these programs will also be aborted. We recommend that you run the Jobs command to view background Jobs before exiting Shell.

Migrate a Linux Account

The method for migrating a Linux Account is as follows:

1. Ensure that the new account to be added to the system is placed in the new location. This is done by modifying the HOME value in the/Etc/Default/Useradd file.

For example, HOME =/Home2 creates the HOME Directory of the new account under/home2.

2. To move an existing account to a new location, follow these steps:

First, copy the home directory and directory attributes of an existing account to the new location. Run the following command:

Cp-a/Home/Home2 or Cp-rpd/Home/Home2

Then, modify the Home_directory domain of the corresponding record in the/Etc/Passwd file to/Home2/Username.

In these two steps, you can move the old account to a new location. After you make sure that no error exists, you can delete the old home directory of the old account to free up space for the original file system.
Related Article

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.