Andy
A-ndy.dev

A-ndy.dev

Terminal Shell

Andy's photo
Andy
·Aug 7, 2021·

1 min read

Here is command shell you can use in ubuntu terminal.

Set timezone

$ timedatectl set-timezone Asia/Jakarta

Monitoring CPU Usage

$ top -F -R -o cpu

List User

$ sudo cat /etc/passwd

Information About System

$ landscape-sysinfo

Information HDD

$ sudo df -h #human-readable $ sudo df #all information

Information Disk Usage

$ sudo df -sh *

Location Php.ini on Apache

/etc/php5/apache2/php.ini

Rsync Alternative Port

rsync -e "ssh -pPORTNUMBER" user@server:/path/to/file /home/user/path/to/file

Copy files from 14 days ago

$ cd /var/www/uploads/ $ find . -mtime -14 > /tmp/list_rsync_14daysago $ mkdir /var/www/uploads-14daysago $ rsync -arhv --progress --files-from=/tmp/list_rsync_14daysago /var/www/uploads /var/www/uploads_14daysago

Download

$ curl -O theurl.com/files

Tar

##Create Tar Gz $ tar -czf filename.tar.gz

##Extract Tar Gz $ tar -xzf filename.tar.gz

Zip multiple directories into individual zip files

for i in */; do zip -r "${i%/}.zip" "$i"; done

Search file and delete

## Delete File $ find . -type f -name "FILE-TO-FIND" -exec rm -rfv {} \;

Delete Folder

$ find . -type d -name "FILE-TO-FIND" -exec rm -rfv {} \;

 
Share this