The Chalkboard


List of common terminal commands

Last Updated: [2023-03-30 Thu 05:37]

To many, the terminal on a system is a daunting place. A black box with a small amount of white text in the top left-hand corner. However, this is the most powerful tool on most systems, and when used correctly can get jobs done much faster than trying to fumble around with a clunky graphical solution some developer figured would make only the features they deemed important to be easily accessed.

In this reference guide, I’ve included the popular terminals in the order you’re likely to be using them:

Changing Directories

Command bash PowerShell cmd zsh fish
cd yes yes yes yes yes
chdir yes yes
Set-Location yes

One of the most common commands you’ll encounter in almost any terminal is the cd or change directory command. This simply changes the working directory to another one on the machine.

Powershell uses a cmdlet Set-Location and the cd and chdir commands are aliases of this.

Copying a file

Command bash PowerShell cmd zsh fish
cp yes yes yes
copy yes yes
Copy-Item yes

Move a file

Command bash PowerShell cmd zsh fish
mv yes yes yes
move yes yes
Move-Item yes

The move commands can be used to rename files, however, caution should be taken as they can also overwrite existing files.

Rename a file

Command bash PowerShell cmd zsh fish
rename yes yes
Rename-Item yes

Under unix-like systems, the mv command is used to rename files. See the Moving a file section for more information.

Creating a blank file

Command bash PowerShell cmd zsh fish
touch yes yes yes
New-Item yes

For PowerShell, you need to specify the item is a file

New-Item -ItemType file <filename>

DISCLAIMER: The information provided on this website is generated from my own notes and is provided "as is" and without warranties. Robert Ian Hawdon can not be held responsible for damages caused by following a guide published on this site. This website contains links to other third-party websites. Such links are provided as convienice of the reader. I do not endorce the contents of these third party sites.