Useful Linux Commands
Published: 2026-5-5
Filesystem
du -h --max-depth 1 {DIR}: Disk usage in directory-hmakes the sizes human readable
chmod +x {FILE}: Makes file executablels -hla: List all files in a directory-hmakes the sizes human readable-ldisplays more info, such as file sizes and permissions-alists all files, including hidden ones
Git
git branch -m {NEW_NAME}: Rename the current git branchgit remote set-url origin {NEW_URL}: Set a new remote as origin
Networking
curl -O {URL}: Download a filefirewall-cmd --{add|remove}-port {PORT}/{PROTOCOL}: Open a port in the firewallnetstat -tuln: Shows listening ports-tshows TCP ports-ushows UDP ports-lshows only listening ports, not all connected-nmeans don’t resolve addresses