Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 13, 2020 07:59 am GMT

The linux commands that help me work

Here are some commands to help me with my work.
And what are your useful commands that you use?

Searching for files and folders with the given name

grep -i -n -r 'Search string' /var/www/path/

Shows how many times is the search text in the text and returns the result in numbers.

cat access.log|grep 'Search string' | wc -l

Remove all .gz from /var/log/

find /var/log/ -name "*.gz" -type f -delete

Find and replace text in all files in a directory

find ./ -type f -exec sed -i 's/string1/string2/g' {} \;find /var/log/ -type f -exec sed -i 's/string1/string2/g' {} \;

Unpack tar files

tar -xJfv file.tar.xztar -xvf file.tar.bz2

while

while true; do COMMEND; done

Original Link: https://dev.to/skorotkiewicz/the-linux-commands-that-help-me-work-2o99

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To