Posts

Showing posts with the label Advanced Linux Command

Advanced Linux Command Ease your Life

  Delete large File content immediately : Suppose large file name is access.log then different way to remove large content a. # > access.log b. # true > access.log c. # cat /dev/null > access.log d. # cp /dev/null access.log e. # dd if=/dev/null of=access.log g. # echo -n "" > access.log h. # truncate -s 0 access.log Search top 5 large file size files: #find /var/lib/docker/ -type f -exec du -Sh {} + | sort -rh | head -n 5 # du -a /var/lib/docker/ | sort -rh | head -5 Replacing words or characters:  If you are working with any text file then to replace every instance of any word say “version” with “story” in myfile.txt, you can use sed command as: # sed 's/version/story/g' myfile.txt Additionally, if you want to ignore character case then you may use gi instead of g as: # sed 's/version/story/gi' myfile.txt To Replace a whole line with input start of line parametre #sed -i -e '/^#PasswordAuthentication/s/^.*$/PasswordAuthentication yes/...