Linux Commands

Linux Commands

Remove source folder : 

rm -rf

copy from a folder : 

cp -r /home/madhut\aws.moblize.com/proact2.0.zip /opt/moblize/www

Rename a file:

mv proact2.0.zip proact2.0.118.zip

The “find” command allows you to search for files for which you know the approximate filenames. The simplest form of the command searches for files in the current directory and recursively through its subdirectories that match the supplied search criteria. You can search for files by name, owner, group, type, permissions, date, and other criteria.


To find files that match a specific pattern, use the “-name” argument. You can use filename metacharacters (such as “*”), but you should either put an escape character (“\”) in front of each of them or enclose them in quotes.


find . -name pro\*

if we want to find all the files that start with “pro” in the Documents directory, we would use the “cd Documents/” (without the quotes) command to change to the Documents directory, and then type the following command.

Logs 


How to get the real time logs


Go to the logs folder and if the logs are stored in logs.txt

# tail -f logs.txt

If you want to list only things pertaining to a particular string


# tail -f logs.txt | grep abcde


How to get 10 lines after a matching condition
root@ip-172-31-11-57:/opt/moblize-consumers# tail -f logs.txt | grep -A 5 "Received the File"

Command Line history


Using the command history
Use the up and down key's to scroll through previously typed commands. Press [Enter] to execute them or use the left and right arrow keys to edit the command first. Also see history (below).
The history command


The history command can be used to list Bash's log of the commands you have typed:
This log is called the “history”. To access it type:
history n
This will only list the last n commands. Type “history” (without options) to see the the entire history list.

More info refer (http://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/x1712.htm)



No comments:

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days