(1)In a large folder, I want to find a file containing a certain string, for example, find the file where the function fastatan2 is located in the opencv folder.
Find and grep. The find command is used to find a specific file (directory) in the current folder ),
(2)Write the alias command alias to the system configuration file to prevent the variables defined by yourself from being invalid after Bash is deregistered.
The configuration file you prefer to write is in your home directory. in the bashrc file, the first character of the file name is a vertex. Therefore, this file is a hidden file and must be LS-A for display. However, this does not affect the modification of this file. The Vim. bashrc command will open the configuration file in Vim, Shift + g (that is, g) to move the cursor to the last line of the file, and then add the command alias CLS = 'clear '. Exit vim. Then run source./bashrc on the terminal. In this way, the CLS command will take effect after a bash is opened.
(4)How to display and edit hidden files: This is not a big problem, because the hidden file is not as bad as a common file, but the first character of the file name is '.'. Therefore, to use Cat to show hidden files, you do not need to add any specific parameters. Simply use Cat. bashrc (assuming the file opened is. bashsrc ).
(5)Cancel bash waiting for Firefox
Start Firefox by bash, but wait until Firefox exits to accept other command input. It is inconvenient to open so many bash commands. Solution: EnterFirefox &You can.
(6)Modify Command Prompt
If the computer name is too long, the bash default command prompt will be very long and looks uncomfortable. The solution is to modify the environment variable PS1 value, such as setting PS1 = 'honpey @ lab: \ W: $ '. You can write this sentence to the. bashrc file in the main folder so that the command prompt you set will be changed every time you start the system.
(7)View the disk usage of a file
Du (show disk usage) to view disk usage. The-H parameter is used to display the human-readable format. The output result of DU is usually very long, you can add the-S parameter to omit the sub-directories in the specified directory and only display the total directory. For example, Du-SH/Hello