In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what skills to use Linux, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
1: check programs that are not run by you
Difficulty: advanced
Application: bash (shell for UNIX or LINUX)
Imagine this scenario-you're ready to play a quick Crack Attack with your colleagues in the office, only to find that the box stops when you're about to beat your arrogant subordinate-what makes your machine so slow? This must be because other users use their skilled experience to steal your precious CPU time, server or other weird way, which is really annoying!
OK, let's list all the programs in the system that are not run by you!
Ps aux | grep-v `whoami`
Or, more cleverly, why not list the top ten programs that take the most time:
Ps aux--sort=-%cpu | grep-m 11-v `whoami`
It is probably best to run this directive with root permissions, as this will filter out most of the active daemons. Now that you have this information, you can terminate their process, but what is even more "despicable" is to run xeyes repeatedly on their desktops!
2: replace the same text in multiple files
Difficulty: medium
Application: find / Perl
If you have a file and want to replace it in multiple locations, there are many ways to do it. Call test [someting] to replace Windows with Linux in all files in the current directory. You can run it like this:
Perl-I-pe's test*
To replace Windows in the current directory and all files in the lower directory with Linux, you can run it like this:
Find. -name'* .txt'- print | xargs perl-pi-txt.
Or if you need to make it work only on ordinary files.
Find-type f-name'* .txt'- print0 | xargs-- null perl-pi-e's Greater Windows and Linux Greater'
Saved a lot of time and obtained a high level of master level!
3: merge an unstable terminal
Difficulty: simple
Application: bash
We've all done this-occasionally use less or cat to list a file, or end up browsing binaries, which usually includes all kinds of control codes, alarm sounds, some interesting characters, and some strange color combinations that can easily mess up your terminal display, and in the end, your font will be replaced by some illegible characters, and you don't know what to do. Obviously bash is still working, but you just can't understand what's going on! Send an initialization command to this terminal:
Reset
And then everything went back to normal again.
4: create Mozilla keywords
Difficulty: simple
Application: Firefox/Mozilla
A useful feature on browsers is that they have the ability to enter
Gg > http://www.google.com/search?q=%s
Now select the entry in the bookmark editor and click the Properties button, and now enter a keyword like gg (or any character you choose). S in URL will be replaced by the text content after the keyword. You can use this method to send requests to other sites that rely on your current URL information.
Or, right-click a search area and select the menu option "add a keyword to 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 and get tired of logging in and out, you may feel relieved when you know that this is not necessary. Suppose your computer starts in graphical mode (runlevel 5), by pressing the Control+Alt+F1 key at the same time-you will get a login prompt. Enter your login name and password and execute:
Startx--: 1
To get into your graphics environment. Press Ctrl+Alt+F7 to return to the previous user session, and press Ctrl+Alt+F8 if you want to return to your own user session.
You can repeat this technique: F1 to F6 can identify six console sessions, while F7 to F12 can identify six X sessions. Warning: although this applies in most cases, different variants may implement this feature in different ways.
6: browse faster
Difficulty: simple
Application: KDE
KDE is a niche but useful choice to improve your web browsing experience. Start a KDE control center and select System > KDE performance from the sidebar. Now you can choose to preload the browser instance. In fact, this means that the browser starts running when it is turned on and remains hidden until 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 files to its backup instead of copying everything to its own backup, you can use the tool rsync to implement it. You need to have an account on this remote source backup computer. Here is the command:
Rsync-vare ssh jono@192.168.0.2:/home/jono/importantfiles/* / home/jono/backup/
So we backed up all the files in the / home/jono/importantfiles/ directory at the 192.168.0.2 address 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 your computer seems to be off track, you can use a special NTP tool to make sure it is so accurate that only people in lab coats will need it. You need to install the ntpdate tool, which is usually included in the NTP package, and then you can keep synchronized with the NTP server:
Ntpdate ntp.blueyonder.co.uk
You can get a list of the corresponding NTP servers on www.eecis.udel.edu/~mills/ntp/clock1b.html. If you modify your boot program and include these commands in the script, you can make sure that whenever you start the computer is exactly on time. You can also run a scheduled task to check the time.
9: find the largest file
Difficulty: simple
Application: Shell
A common problem on your computer is that you may want to delete some large files (such as audio or video clips). You can find the largest file in the current directory as follows:
Ls-lSrh
The function of "r" is to list large files at the bottom, while "h" is to give output that is easy for people to read (MB or something like that). You can also search for the largest MP3/MPEG file:
Ls-lSrh * .mp*
You can also search for the largest directory with the following command:
Du-kx | egrep-v "\. /. + /" | sort-n
10:Nautilus shortcut key
Difficulty: simple
Application: Nautilus (a file manager in the Linux graphical interface)
Although many file managers have been designed to manage with the mouse in recent days, it is sometimes more convenient to use the keyboard. Nautilus has some keyboard shortcuts that allow you to browse files quickly:
Open a location file-Ctrl+L
Open parent folder-Ctrl+Up
Use the arrow keys to browse the current folder
You can also use 'emblems' to customize the file icon. Here are a small number of images that are applied to individual files or groups. Open the Edit > Backgrounds and Emblems menu entry, and then drag and drop the image you want.
11: organize your database
Difficulty: simple
Application: MySQL
Whenever you change the structure of an MySQL database or delete a large amount of data from it, the files are likely to be dispersed and cause some performance loss. This is most likely to happen when running query commands. Whenever you want to change the database, remember to run this optimizer:
Mysqlcheck-o
You may find that if you use VARCHAR files, it is necessary to organize your database tables regularly: this variable length column (variable-length columns) is very prone to splitting.
12: faster email
Difficulty: simple
Application: KMail
You don't want to spend three seconds looking for an email client? Don't want to be unable to find the mouse pointer by the decaying icons piled up on the desktop? No matter what you are doing in KDE, you can send an email with a few keystrokes. Enter:
Mailto:plop@ploppypants.com
Pressing return,KMail will start automatically, ready for your words of wisdom. You don't even need to fill in the full email address. This is also valid for Internet addresses: try typing www.slashdot.org to launch the browser.
13: assimilate your structure
Difficulty: simple
Application: GCC
If you run a multiprocessor system (SMP) with the right amount of RAM, you will find it beneficial to run a parallel make when writing code. Compared to running make and executing serial builds by default, parallel build is an effective improvement. Let make allow multiple child to exist at the same time when building, and convert it with-j as follows:
Make-j4; make-j4 modules
14: save battery power
Difficulty: medium
Application: hdparm
Chances are you're already familiar with using hdparm to adjust a hardware driver, but it can also save battery life on your laptop or make your life quieter by reducing the speed of your hard drive.
Hdparm-y / dev/hdb hdparm-Y / dev/hdb hdparm-S 36 / dev/hdb
In order, these commands will switch the hardware to Standby mode, then Sleep mode, and eventually set the Automatic rotation timeout. The end contains a block of numeric variables in 5 seconds (for example, a value of 12 equals a minute).
By the way, this habit of reducing rotation time to 5 seconds deserves a special user-friendly award-there may be some historical reason for setting this value, but we don't know. If you happen to know why, please let us know by letter!
15: wireless speed management
Difficulty: medium
Application: iwconfig
The speed of transmission between a radio sending / receiving device and other devices depends on how many signals are available. If the transmission needs to be maintained when the signal is weakened, it is necessary to reduce the transmission speed of the radio. In general, radio will find its own available signals and automatically choose the fastest speed.
In the edge area, the signal strength is barely enough, which may result in unnecessary packet loss due to radio constantly debugging the connection speed. If you cannot enhance the antenna gain, or the location of the mobile device to get a more adequate signal, try forcing the card to synchronize to a lower rate. In this way, radio will reduce the frequency of debugging and, in fact, transfer faster than using continuously triggered links. Different drives have different link speed settings. In Linux, you can use iwconfig to set the speed:
Iwconfig eth0 rate 2M
This directive forces broadcasts to always synchronize in 2Mbps, even if there are other available speeds. You can also set a clear speed limit to allow the card to automatically work at any speed below this limit, but not higher than it. For example, you can apply it to the connection illustrated above:
Iwconfig eth0 rate 5.5M auto
The above instruction allows the driver to set the speed limit to 5.5Mbps, which is slow but not fast. If you want to restore card to fully automatic scaling, you just need to make it work automatically.
Iwconfig eth0 rate auto
They usually extend farther when stuck in 1Mbps than when they are in 11Mbps. Between these two rates, Orinoco cards have the difference of 12dB, that is, four times the potential transmission distance that can be obtained by reducing the data rate.
16: dredge the opening
Difficulty: medium
Application: netstat
To get a list of network servers that are listening on the Linux server, use the netstat program:
Root@catlin:~# netstat-lnp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0 0 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 5280 0.0.0 0 LISTEN 698/perl tcp 0 0 0.0.0 0 V 80 0.0.0 0 V * LISTEN 217/httpd tcp 0 0 10.42.3.2 V 53 0.0.0 V * LISTEN 220/named tcp 0 0 10 42.4 6 V 53 0 .0.0.0: * LISTEN 220/named tcp 00 127.0.0.1 LISTEN 200/sshd udp 53 0.0.0.0 LISTEN 220/named tcp 00 0.0.0.0 LISTEN 200/sshd udp 00 0.0.0.0 22 0.0.0.0 LISTEN 200/sshd udp 00 0.0.0.015 32768 0.0.0.0 LISTEN 200/sshd udp 00 10.42.3.2 220/named udp 00 10.42.4.6 : 53 0.0.0.0222/dhcpd raw * 220/named udp 0 0127.0.0.1222/dhcpd raw 0 0127.0.0.1222/dhcpd raw 0 0.0.0.015 00.0.0.015 00.0.0.015 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.014
The above message tells you that the process with PID of 698 is a Perl process bound to port 5280. If you are not a superuser, the system will not show which program is running on which port.
17: faster hardware drivers
Difficulty: advanced
Application: hdparm
You may already know that the hkparm tool can be used to test hard drive speed and change some settings. It can also be used to optimize driver performance and turn on some functions that are turned off by default. Before we begin, I would like to inform you that changing the driver options may cause data corruption, so please back up all your important data first. The following commands can be used to test speed:
Hdparm-Tt / dev/hda
You will see something like this:
/ dev/hda: Timing buffer-cache reads: 128MB in1.64 seconds = 78.05MB/sec Timing buffered disk reads:64 MB in 18.56seconds = 3.45MB/sec
Now we can try to speed it up. Find out which option is currently used in your driver settings, and then pass the name of the hardware to hdparm:
Hdparm / dev/hda / dev/hda: multcount=16 (on) I support=0 O support=0 (default 16-bit) unmaskirq=0 (off) using_dma=0 (off) keepsettings = 0 (off) readonly = 0 (off) readahead=8 (on) geometry = 4039516max 63, sectors = 40718160, start = 0
This is equivalent to a default setting. Most Linux distributions choose a security option that runs on most hardware. In order to get faster, you may want to activate the dma mode, and then of course adjust the Imax O support. Most modern computers support Mode 3, which is a 32-bit conversion mode with almost double flux. You can also try:
Hdparm-c3-d1/dev/hda
Then go back to this speed and check the difference. Check which modes your hardware supports, and then learn how to set them in hdparm's man manual.
18: the available time in your hands
Difficulty: advanced
Application: Perl
For computing, the wasted resources are those that could have been better used. No matter what other programs you are running, why not try running a process that displays the current average load in the terminal title bar in real time?
Save this as a script and name it tl, and then save it in your ~ / bin directory:
#! / usr/bin/perl-w use strict; $| +; my $host= `/ bin/ hostname`; chomp $host; while (1) {open (LOAD, "/ proc/loadavg") | | die "Couldn't open / proc/loadavg: $!\ n"; my @ load=split (/ /,); close (LOAD); print "$host: $load [0] $load [1] $load [2] at", scalar (localtime); print "07"; sleep 2;};
If you want to use load average and the current time of the machine you logged in, replace the titlebar name with Xining tl&. It works well in the background, even if you run an interactive program like Vim.
19: complete a screenshot without using X
Difficulty: simple
Application: Shell
There are a lot of screen capture tools, but most of them are based on X. This leads to a problem that when you run an X application, it will interfere with the application you want to crawl-perhaps a game or even a Linux installer. But if you use the great ImageMagick import command, you can crawl the X module through the console. Quite simply, open a virtual terminal (such as Ctrl+Alt+F1) and enter the following:
Chvt 7; sleep 2; import-display: 0-window root sshot1.png; chvt 1
The chvt command changes the virtual terminal, while the sleep command gives time to redraw the screen. The import command will capture all the displays and save them to a file before the final chvt command returns you to the virtual terminal again. Please make sure you enter all the commands on the same line.
This works even on Linux installers, where many installers leave only one console to run in the background-a state-of-the-art screen grabber that runs everywhere only needs to load some of the libraries it needs into a floppy / CD.
20: remotely access your program
Difficulty: simple
Application: X
If you want to lie in bed and use your Linux laptop to access your application from your Window machine, you can use SSH to do so. First you need to activate the following settings in / etc/ssh/sshd_config:
X11Forwarding yes
Now we can run GIMP on 192.168.0.2 using the following command:
Ssh-X 192.168.0.2 gimp
21: use the man manual
Difficulty: simple
Application: man
If you need help with a particular project or command, the man manual is a good start. Usually you use man to access the man manual, but you can also search the man page by the keywords described on a special man page. For example, search all man pages that detail login:
Man-k login
When you visit a man page, you can also use the slash key to search for a specific word instead of using the man page itself. It is very simple to press "/" on your keyboard and enter the search term.
22: talk to your doctor
Difficulty: simple
Application: Emacs
If Emacs is just a text editor, it's like saying that Triumph is just a motorcycle, or that the World Cup is a quadrennial football match. Well, it's a text editor, but it's only a small part. Give me a chestnut? Open the editor, press the ESC key, then press X, and then enter doctor: you will enter a bizarre conversation with an imaginary but skilled psychotherapist. If you want to dawdle with your time, this is a good way.
Esc-X tetris
Will turn your editor into an old, popular playground game.
Is this the end of madness? Absolutely not! Check your distribution's package and list other features they bundle on your Emacs: we see chess, Perl integration, IRC chat, French translation, HTML conversion, a Java development environment, smart editing, and even something called "semantic bovinator". We really have no idea what the last one can do, but we conclude that you dare to try it anyway! Please read the disclaimer first!
23: generate package association diagram
Difficulty: simple
Application: Debian
The most controversial aspect of the Debian system is that it can install a package and automatically satisfy its dependency. If you want to graphically represent the relationships between these packages (which is useful for understanding how the system works), you can use the non-free Graphviz package (apt-get install graphviz) in Debian and use the following command:
Apt-cache dotty > debian.dot
This command generates an image file and stores it in dotty:
Dotty debian.dot
24: uninstall the driver for busy state
Difficulty: simple
Application: bash
You should be familiar with this situation-try to uninstall a driver, but the system tells you that it is busy. But what program is in use? A short single line of code will tell you:
Lsof + D / mnt/windows
This returns the command and process ID and any tasks that are accessing the / mnt/windows directory. You can then locate them, or use the kill command to terminate them.
The above is all the contents of this article entitled "what are the skills of using Linux?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.