Skip to content
Menu
vernon.wenberg.net
vernon.wenberg.net
January 29, 2024July 21, 2024

Useful Linux CLI Commands

Edit crontab of user where www-data is the user

crontab -u www-data -e

Sync two directories. This overwrites files with the same names

rsync -a /dir1/ /dir2/

Show information about a file or directory

stat file.txt

Show file or directory size

du -sh directory/

Zip up a directory

zip -r zip_filename.zip

Unzip file to current directory

unzip zip_filename.zip

List files and directories in a zip file

zipinfo zip_filename.zip

Search for “whatever” in file.txt

grep -i “whatever” file.txt

Run last command

!!

Run last command as root

sudo !!

Debug SSH connection

ssh -vvvvA user@host

Get information about a site’s SSL certificate

openssl s_client -connect example.com:443

Using UFW, allow from a source to a port

ufw allow from 172.25.0.0/21 to any port 53

Notes

One of the easiest tools to use if you don’t know the syntax of a command is TLDR. On Ubuntu you
can simply install it using apt, apt install tldr. Simply use tldr zip where zip is the
command you wish to know more about.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to print (Opens in new window) Print
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn

Like this:

Like Loading...

Related

Disclaimer

These posts are notes for me. These are not guides and you should not use these instructions as step-by-step instructions without knowing what they do.

Recent Posts

  • Docker Reference
  • Useful Commands for Windows Subsystem for Linux
  • FortiManager Local-In Policy
  • Mount Google Drive in Linux using rclone
  • Restore original Explorer context menus in Windows 11

Mastodon

  1. Loading Mastodon feed...

©2025 vernon.wenberg.net | Powered by WordPress and Superb Themes!
%d