The usefull linux commands
- Welcome to our guide on mastering essential command-line operations and system management tasks!
- In this blog post, we'll explore practical tips and tricks to streamline your workflow and boost productivity.
- Whether you're a beginner or an experienced user, these techniques will help you navigate the command line with ease.
- Join us as we dive into managing log files, executing commands efficiently, and optimizing your system administration skills for success.
How to find and delete logs file MORE THAN 30 DAYS OLD
# find /path/to/log/ -type f -name \*.log\* -mtime +30 -exec rm {} \; > /dev/null 2>&1
How to find and delete logs file LESS THAN 30 DAYS OLD
# find /path/to/log/ -type f -name \*.log\* -mtime -30 -exec rm {} \; > /dev/null 2>&1How to one-liner that allows to create a directory and move into it at the same time.
# mkdir test-dir && cd $_
How to display size of folder.
#du -csbh /path/to/folderHow to display output as a table
# cat /etc/passwd | column -t -s:Run last command as root
# sudo !!Return to previous directory
# cd -How to add passphrase into id_rsa file use ssh-keygen command
#ssh-keygen -f id_rsa -pHow to combine wget and tar in one command
# wget -qO- http://link-download | tar xvzHow to combine find and xargs command
# find /home/huupv -name *.jpg | xargs -d '\n' ls -llgrep command regurar expression match all IP address in a log file
grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"how to check file duplicate
find /home/huupv/ -type f -print0 | xargs -0 md5sum | sort | uniq -D -w 32How to determining own ip public
curl ipinfo.io/ipor
curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
In conclusion, this blog post offers a comprehensive guide to managing log files and executing essential command-line operations efficiently. From deleting old logs to creating directories, displaying folder sizes, and performing various commands, readers gain valuable insights into streamlining their workflow and optimizing system management tasks. Whether you're a beginner or an experienced user, these tips and tricks will enhance your productivity and proficiency in handling system administration tasks. I hope this is helpful to you. Thank you for reading the huuphan.com page!
Comments
Post a Comment