20 commands that are very useful to intermediate Linux users __linux

Source: Internet
Author: User
Tags doxygen locale parent directory
20 commands that are very useful to intermediate Linux users

Source: Tecmit Translation: Oschina

Perhaps you've found the first article very useful, and this article is an extension of the 20 commands that are very useful for primary Linux users. The purpose of the first article is to prepare for beginners, and this article is for the senior users of Linux. Here you will learn how to customize your search, know what processes are going on and how to deactivate them, how to use the power of Linux, and how to compile C, C + +, and Java programs within your system.

21. Command: find

Searches for files in the specified directory, starting at the parent directory, and then searching subdirectories.

1 2 3 4 5 6 7 8 9 10 11 root@tecmint:~# find-name *.sh/desktop/load.sh/desktop/test.sh./desktop/shutdown.sh run-mozilla.sh./downloads/kdewebdev-3.5.8/quanta/scripts/externalpreview.sh./downloads/kdewebdev-3.5.8/admin/ doxygen.sh./downloads/kdewebdev-3.5.8/admin/cvs.sh./downloads/kdewebdev-3.5.8/admin/ltmain.sh./Downloads/ wheezy-nv-install.sh

Note: The '-name ' option is search case sensitive. You can use the '-iname ' option so that you can ignore case in search. (* is a wildcard, you can search all the files; Sh ' You can use a filename or part of the file name to make the output)

1 2 3 4 5 6 7 8 9 10 11 root@tecmint:~# Find-iname *. SH (Find-iname *. Sh/find-iname *.sh)./desktop/load.sh/desktop/test.sh/desktop/shutdown.sh./binary/firefox/run-mozilla.sh nloads/kdewebdev-3.5.8/quanta/scripts/externalpreview.sh./downloads/kdewebdev-3.5.8/admin/doxygen.sh./ downloads/kdewebdev-3.5.8/admin/cvs.sh./downloads/kdewebdev-3.5.8/admin/ltmain.sh./Downloads/ wheezy-nv-install.sh
1 2 3 4 5 6 7 8 9 10 11-12 root@tecmint:~# find-name *.tar.gz/var/www/modules/update/tests/aaa_update_test.tar.gz./var/cache/ flashplugin-nonfree/install_flash_player_11_linux.i386.tar.gz./home/server/downloads/drupal-7.22.tar.gz./home/ server/downloads/smtp-7.x-1.0.tar.gz./home/server/downloads/noreqnewpass-7.x-1.2.tar.gz./usr/share/gettext/ archive.git.tar.gz./usr/share/doc/apg/php.tar.gz./usr/share/doc/festival/examples/speech_pm_1.0.tar.gz./usr/ share/doc/argyll/examples/spyder2.tar.gz./usr/share/usb_modeswitch/configpack.tar.gz

Note: The above command looks for all files containing ' tar.gz ' under the root directory and all folders and the subdirectories of the loaded device.

For more details on the ' find ' command please refer to the Find command examples in Linux

22. Command: grep

The ' grep ' command searches for a line in the specified file that contains the given string or Word. Search for examples of ' tecmint ' in '/etc/passwd ' files

1 2 3 root@tecmint:~# grep tecmint/etc/passwd tecmint:x: 1000:1000:tecmint,,,:/home/tecmint:/bin/bash

Using the '-I ' option ignores case.

1 2 3 root@tecmint:~# grep-i tecmint/etc/passwd tecmint:x: 1000:1000:tecmint,,,:/home/tecmint:/bin/bash

Use the '-r ' option to recursively search all the rows that contain the string "127.0.0.1" from the directory.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17-18 root@tecmint:~# grep-r "127.0.0.1"/etc/  /etc/vlc/lua/http/.hosts:127.0.0.1/etc/speech-dispatcher/ modules/ivona.conf: #IvonaServerHost "127.0.0.1"/etc/mysql/my.cnf:bind-address      = 127.0.0.1/etc/apache2/mods-available/status.conf:    Allow from 127.0.0.1:: 1/etc/apache2/ mods-available/ldap.conf:    Allow from 127.0.0.1::1/etc/apache2/mods-available/info.conf:     Allow from 127.0.0.1::1/etc/apache2/mods-available/proxy_balancer.conf:#    Allow 127.0.0.1:: 1/etc/security/access.conf:#+: root:127.0.0.1/etc/dhcp/dhclient.conf: #prepend domain-name-servers 127.0.0.1; /etc/dhcp/dhclient.conf:#  option Domain-name-servers 127.0.0.1; /etc/init/network-interface.conf:   ifconfig lo 127.0.0.1 Up | | true/etc/java-6-openjdk/net.properties:# localhost & 127.0.0.1). /etc/java-6-openjdk/net.properties:# Http.nonproxyhosts=localhost|127.0.0.1/etc/java-6-openjdk/net.properties:# localhost & 127.0.0.1). /etc/java-6-openjdk/net.properties:# ftp.nonproxyhosts=localhost|127.0.0.1/etc/hosts:127.0.0.1     localhost

Note: You can also use the following options:

1-w search words (egrep-w ' word1|word2 '/path/to/file).

2-c is used to count the rows that meet the requirements (i.e., total number of the "times the" pattern matched) (grep-c ' word '/path/to/file).

3–color Color Output (Grep–color server/etc/passwd).

23. Command: man

' Man ' is the system help page. Man provides online documentation that commands all options and usage. Almost all commands have their help pages, such as:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 root@tecmint:~# Man Mans    Man (1)                                                                   Manual Pager Utils                                                                  Mans (1)    NAME         Man- An interface to the on-line reference manuals    Synopsis         man  [-C  file]  [-d]  [-d]  [--warnings[=warnings]]  [-r  encoding]  [-L  locale]   [-m  system[,...]]   [-m  path]  [-S list] [e-extension] [-i|-i]         [--regex|-- Wildcard] [--names-only] [A] [u] [--no-subpages] [P Pager] [-R Prompt] [-7] [e-Encoding] [--no-hyphenation] [--no-just ification]  [P         string] [-t] [-t[device]] [-h[browser]] [-x[dpi]] [-Z] [[section] page ...] ...         man-k [apropos options] regexp ...          man-k [-w|-w] [S-list] [-i|-i] [--regex] [section] term ...         man -F [Whatis options] page ...         man-l [-C file] [-d] [-d] [--warnings[=warnings]] [R Encoding] [-l locale] [-P Pager] [R Prompt] [-7] [-E Encoding] [-P string] [-T] [-t[device]]         [-h[browser]] [-x[dpi]] [-z] file ...         man-w|-w [-C file ] [-d] [d] page ...         man-c [-C file] [-d] [d] page ...    &nbs p;    man [-HV]

The above is the System help page for the Man command, similar to the help page for cat and LS.

Note: The system help page is designed for use and learning of commands.

24. Command: PS

The PS command gives the state of a running process in which each process has a specific ID to become a PID.

1 2 3 4 5 root@tecmint:~# PS PID TTY time CMD 4170 pts/1 00:00:00 bash 9628 PTS/1 00:00:00 PS

Use the '-A ' option to list all processes and their PID.

1 2 3 4 5 6 7 8 9 10 11 root@tecmint:~# ps-a PID TTY time CMD 1?        00:00:01 Init 2?        00:00:00 Kthreadd 3?        00:00:01 ksoftirqd/0 5?        00:00:00 kworker/0:0h 7?        00:00:00 kworker/u:0h 8?        00:00:00 migration/0 9? 00:00:00 rcu_bh .....

NOTE: PS commands are useful when you want to know which processes are running or need to know the process PID you want to kill. You can query the specified output by combining it with ' grep ', for example:

1 2 3 4

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.