Linux skills that every geeks should know (1)

Source: Internet
Author: User
Tags rsync

What is the distinction between common Linux users and super geeks? Simple: it is used to learn the skills, tips, and technical skills that transform Long-time work into instant work. If you want to improve your efficiency without having to do the data collection errands, we have collected more than 50 simple and easy-to-learn Linux skills to help you work more easily, and maximize the use of your computer. Enjoy it!

1: Check programs not run by you

Difficulty: Advanced

Application: bash: UNIX or LINUX shell)

Imagine this scenario-you are ready to play a quick Crack Attack game with your colleagues in the office, when you are about to defeat your arrogant subordinate, the square stops-what makes your machine so slow? This must be because other users use their skillful experience to steal valuable CPU time, servers, or other strange ways. This is really annoying!

Well, let's list all programs in the system that are not run by you!

 
 
  1. ps aux | grep -v `whoami` 

Or, even more cleverly, why not list the top 10 programs that take up the most time:

 
 
  1. ps aux--sort=-%cpu | grep -m 11 -v `whoami` 

It may be better to run this command with the root permission, because it can filter out most active background programs. Now that you have this information, you can terminate their processes, but what's more mean is to repeatedly run xeyes on their desktops )!

2: replace the same text in multiple files.

Difficulty: Moderate

Application: find: a command in Linux)/Perl

If you have a file and want to replace it in multiple locations, there are many methods to achieve this. Call test [someting] to replace Windows from all files in the current directory with Linux. You can run it like this:

 
 
  1. perl -i -pe 's/Windows/Linux/;' test* 

To replace Windows in the current directory and all files in the lower directory with Linux, run the following command:

 
 
  1. find . -name '*.txt' -print | xargs perl -pi -e's/Windows/Linux/ig' *.txt 

Or, if you want to make it only work on common files:

 
 
  1. find -type f -name '*.txt' -print0 | xargs --null perl -pi -e 's/Windows/Linux/' 

It saves a lot of time and gets a high-level level of master!

3: merge an unstable Terminal

Difficulty: simple

Application: bash

We have already done this-occasionally using less or cat to list a file, or ending with browsing a binary file, this usually contains various control code, Buzz, interesting characters that can easily mess up your terminal display, and some strange color combinations. Finally, your font will be replaced by some unrecognizable characters, but you don't know what to do. Obviously bash continues to work, but you just cannot understand what happened! Send an initialization command to this terminal:

 
 
  1. reset 

Then everything will return to normal again.

4: Create Mozilla keywords

Difficulty: simple

Application: Firefox/Mozilla

A useful feature in browsers is that they have the ability to search for everything about onion by entering gg onion. The same function can also be implemented on Mozilla. You can click Bookmarks)> Manage Bookmarks to Manage Bookmarks) and then add a new Bookmarks. The added URL is like this:

 
 
  1. http://www.google.com/search?q=%s 

Now select the entry in the bookmarkeditor and click the Properties attribute) button. Enter a keyword similar to gg or any character you may choose. % S in the URL will be replaced by text content after the keyword. You can use this method to send requests to other websites that depend on your current URL.

Alternatively, right-click a search area and select the menu option "add a keyword for this search ...". The next session will allow you to use a specified keyword.

5: run multiple X sessions

Difficulty: simple

Application: X

If you share your Linux box with others, you may feel relieved when you know that this is not necessary. Assume that your computer starts runlevel 5 in graphic mode. Press Control + Alt + F1 at the same time-you will receive a logon prompt. Enter your login name and password and then execute:

 
 
  1. startx -- :1 

To enter your graphic environment. Press Ctrl + Alt + F7 to return to your previous user session. If you want to return to your own user session, press Ctrl + Alt + F8.

You can repeat this technique: F1 to F6 can recognize six console sessions, while F7 to F12 can recognize six X sessions. Warning although this is applicable in most cases, different variants may implement this function in different ways.

6: faster browsing

Difficulty: simple

Application: KDE: a Linux Desktop Environment)

KDE is a small but useful choice for improving your web browsing experience. Start a KDE control center and select System from the toolbar)> KDE performance. Now you can choose to pre-load the browser instance. In fact, this means that the browser starts running at startup and remains hidden before you use it. When you want to use it, it appears almost instantly.

7: simply back up your website

Difficulty: simple

Application: Backups

If you want to back up a directory from a computer, but you just want to copy the changed file to its backup instead of copying everything to their respective backups, you can use rsync to implement it. You need to have an account on this remote source backup computer. The following command is used:

 
 
  1. rsync -vare ssh jono@192.168.0.2:/home/jono/importantfiles/* /home/jono/backup/ 

In this way, all the files in the/home/jono/importantfiles/directory of 192.168.0.2 are backed up to the/home/jono/backup directory on the current machine.

8: Keep your clock on time

Difficulty: simple

Application: NTP

If you find that the clock on the computer seems to be out of line with time, you can use a special NTP tool to ensure that it is only needed by people wearing lab servers. You need to install the ntpdate tool, which is usually included in the NTP package, and then you can maintain synchronization with the NTP server:

 
 
  1. ntpdate ntp.blueyonder.co.uk 

You can go to www.eecis.udel.edu /~ Obtain the list of corresponding ntp servers on mills/NTP/clock1b.html. If you modify your boot program and include these commands in the script, you can ensure that the computer is fully started at any time. You can also run a scheduled task to check the time.

9: Find the largest file

Difficulty: simple

Application: Shell

A common problem in the computer is that you may want to delete large files like audio or video clips ). You can find the largest file in the current directory as follows:

 
 
  1. ls -lSrh 

"R" is used to list large files, while "h" is an output that is easy to read (MB or so ). You can also search for the largest MP3/MPEG file:

 
 
  1. ls -lSrh *.mp* 

You can also use the following command to search for the largest directory:

 
 
  1. du -kx | egrep -v "\./.+/" | sort -n 

10: Nautilus shortcut

Difficulty: simple

Application: Nautilus: A File Manager in the Linux graphic interface)

Although many file managers have recently been designed to use the mouse for management, it is sometimes easier to use the keyboard. Nautilus has some keyboard shortcuts that allow you to quickly browse files:

  • Open a location file-Ctrl + L
  • Open the parent folder-Ctrl + Up
  • Use the arrow key to browse the current folder

You can also use 'emblems' to customize file icons. A small number of images are used to display individual files or groups. Open the Edit> Backgrounds and Emblems menu entry, and drag and drop the image you want.


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.