Master Essential Unix Commands: wget, scp, ssh-keygen, chmod, tar & Aliases
This guide walks experienced command‑line users through six essential Unix utilities—wget, scp, ssh-keygen, chmod, tar, and alias—explaining their purpose, key options, and practical examples such as downloading files, secure copying, key generation, permission management, archiving, and command shortcuts.
wget
On Unix‑like systems, wget downloads files via HTTP, HTTPS, or FTP. It is included in most Linux distributions. The simplest usage provides the URL of the file to retrieve:
wget http://website.com/static/images/header.jpg wgetruns non‑interactively, allowing it to continue downloading after you log out.
scp
scp(secure copy) transfers files between a local machine and a remote host over SSH. It works like cp but with a remote source or destination.
Copy a remote file to the local directory:
scp [email protected]:/path/to/foobar.txt /some/local/directoryCopy a local file to a remote server:
scp /some/local/directory/foobar.txt [email protected]:/destination/path/Use the -r option to copy directories recursively.
ssh-keygen
The ssh-keygen command creates a new SSH key pair, which can be added to services such as GitLab or Bitbucket to enable password‑less pushes.
Generate an Ed25519 key pair (recommended): ssh-keygen -t ed25519 Research other signature algorithms if needed; the process typically takes a few minutes.
chmod
chmodchanges file system object permissions on Unix‑like operating systems. Correct permission settings are crucial for security and functionality.
Example: grant read/write permissions to the user and group for robots.txt: chmod 664 robots.txt Example: give user and group read/write/execute on public/images, others read/execute: chmod 775 public/images Refer to the Wikipedia page for detailed mode specifications.
tar
tarcreates and extracts archive files. To archive a directory: tar -cvf my-archive.tar /path/to/directory To extract the archive to a specific location:
tar -xvf my-archive.tar -C /home/myfolder/alias
Aliases let you define short names for long commands, improving workflow. A temporary alias for the current session:
alias short-command="your custom and very long command here"To make an alias persistent, add it to your shell’s configuration file (e.g., ~/.bashrc or ~/.zshrc).
Output Redirection and Command Chaining
Redirect command output to a file using >: ls -al > myfile Combine multiple commands with a semicolon ( ;) to run them sequentially regardless of success: ls -al; pwd; Run the second command only if the first succeeds using logical AND ( &&), or only if the first fails using logical OR ( ||).
mkdir images && cd imagesSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
