AKZN Notes

Archives for My Lazy and Forgetful Mind

Linux Common Command

Last Modified on

Linux Common Command

show port

 sudo netstat -tuln

Copy File/Folder

cp

cp -a /source/. /dest/

If you want to copy content of folder. If you want to copy folder content and parent, remove [dot]

rsync

rsync -r --progress /source/. /dest/

same with cp, but copy only the files that have changed

Mount/Unmount USB/removable drive

mount

  1. list drive with lsblk
  2. make mount point
    mkdir /media/usbdrive/
  3. mount drive to created dir
    mount /dev/sdb1 /media/usbdrive/

    unmount

    sudo umount /media/pendriv

Show Last n Connected Users

n = change with number list you want to show

last -n

Get Real Path

readlink -f foo.bar

Cron log

journalctl -u cron.service
sudo grep CRON /var/log/syslog

Leave a Reply

Your email address will not be published.