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>&1
How 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/folder
How 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 -p
How to combine wget and tar in one command
# wget -qO- http://link-download | tar xvz
How to combine find and xargs command
# find /home/huupv -name *.jpg | xargs -d '\n' ls -ll
grep 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 32
How to determining own ip public 
curl ipinfo.io/ip
or
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

Popular posts from this blog

zimbra some services are not running [Solve problem]

Bash script list all IP addresses connected to Server

How to install php7 on centos 6