linux tools-basic

 

 

Help class command

whatis gcc

which gcc

whereis gcc

who gcc

info gcc

man gcc

 

man of Classification and Labeling page belongs ( commonly used classification 1 and Category 3)

(1), or the user may operate the command is an executable file (2), the system kernel can call the functions and tools (3), a number of commonly used functions and a database (4), description (5) the device file is provided format file or some files (6), Games (7), and protocol conventions. Such as Linux standard file systems, network protocols, ASCⅡ, codes description content (8), system administrators can use the management regulations (9), and kernel-related documents

 

View the number of files in the current directory:

$find ./ | wc -l

Sorted by time to display the directory entry list manner ls -lrt

2.4. Find the directory and file find / locate

Search for files or directories:

$find ./ -name "core*" | xargs file

Find the destination folder if there obj file:

$find ./ -name '*.o'

The current directory and subdirectories recursively delete all .o files:

$find ./ -name "*.o" -exec rm {} \;

find a real-time look, if you need faster query, you can try the locate ; the locate will be indexed database file system, if there is a file update, you need to perform an update command to update the index database on a regular basis :

$locate string

Looking for a path string contains:

$updatedb

Unlike find, locate not real-time search. You need to update the database, index file to get the latest information.

  • Chown change file owner
  • Change file read, write, execute, and other attributes chmod
  • Recursive subdirectories Review: chown -R tuxapp source /
  • Added a script executable permissions: chmod a + x myscript

 

2.8. Added to the file aliases

Create a symbolic link / hard link:

ln cc ccAgain: hard-wired; delete one, will still be able to find; ln -s cc ccTo: symbolic link (soft link); delete the source, the other can not be used; (behind a ccTo for the new file)

 

PATH=$APPDIR:/opt/app/soft/bin:$PATH:/usr/local/bin:$TUXDIR/bin:$ORACLE_HOME/bin;export PATH

2.11. Bash quickly enter or delete

hot key:

Ctl-U to delete all the characters the cursor to the beginning of the line, and in some settings, delete whole line Ctl-W delete characters between a space recently cursor to the front of the current Ctl-H backspace, delete the cursor in front of the character Ctl-R the closest match a file, then output   to find the total number of record.log included AAA, but does not contain a record of the BBB: cat -v record.log | grep AAA | grep -v BBB | wc -l

Common; I use the principle of command shell script is written in a single line, try not to over two lines; if there is demand for more complex tasks, it is still considered python;

3.1. File Finder

Find txt and pdf file:

find . \( -name "*.txt" -o -name "*.pdf" \) -print

Regular way to find .txt and pdf:

find . -regex  ".*\(\.txt|\.pdf\)$"

-iregex : case-insensitive regular

Negative parameters, non-txt to find all text:

find . ! -name "*.txt" -print

Specify search depth, print out the files in current directory (depth 1):

find . -maxdepth 1 -type f


Guess you like

Origin www.cnblogs.com/lizhensheng/p/11117174.html