Useful Linux Commands
Filesystem#
du -h --max-depth 1 {DIR}: Disk usage in directory
-h makes the sizes human readable
chmod +x {FILE}: Makes file executable
ls -hla: List all files in a directory
-h makes the sizes human readable
-l displays more info, such as file sizes and permissions
-a lists all files, including hidden ones
Git#
git branch -m {NEW_NAME}: Rename the current git branch
git remote set-url origin {NEW_URL}: Set a new remote as origin
Networking#
curl -O {URL}: Download a file
firewall-cmd --{add|remove}-port {PORT}/{PROTOCOL}: Open a port in the firewall
netstat -tuln: Shows listening ports
-t shows TCP ports
-u shows UDP ports
-l shows only listening ports, not all connected
-n means don't resolve addresses