Mac Terminal Commands – Complete List This is a complete A- Z index of all Mac commands and the terminal events associated with those commands. We have compiled this list by using official sources and have explained more clearly and elaborately about each of them. Make Terminal windows stand out with profiles. When you’re logged in to several servers, unique background colors and window titles specified in profiles help you easily spot the right Terminal window. Use profiles built into Terminal, or create your own custom profiles. How to create profiles for Terminal. How many times did you have something running on your Mac and you wanted to make. In this post, I will about Windows Command Line (CMD) and Mac OS Terminal Navigation Commands. Knowledge of CMD/Terminal commands may be needed for using command line interfaces (CLI) of applications where Graphical User Interface is missing, or when CLI provides a faster/easier way to perform a task. Let’s see some of the commands.
Sometimes, even the simplest tasks can be forgotten if not practiced and repeated. In this short tutorial, I am going to show you some basic command line commands in Microsoft Windows, and their equivalent commands in Apple Mac OS Terminal. This is by no means a complete reference to the available commands, just a short list of some common commands available to you on your operating system. In this post, I will about Windows Command Line (CMD) and Mac OS Terminal Navigation Commands.
Terminal is Mac OS X way into the command line world. It is designed for you to typing in specific commands that you would not be able to do otherwise. This is great for customizing your Mac and unveiling hidden features. It is also a good way to destroy you system because you screwed something up.
Knowledge of CMD/Terminal commands may be needed for using command line interfaces (CLI) of applications where Graphical User Interface is missing, or when CLI provides a faster/easier way to perform a task. Let’s see some of the commands
The CMD/Terminal window
To open the CMD window in Microsoft Windows you may follow several ways, one of them being choosing Run option from the start menu, typing “cmd” in run window, and clicking “enter”. This will open the CMD window in Microsoft Windows
- CMD window
Here you will see the version of the Operating System, and the path to the home folder. The white sign in the picture points your current location in the disk. Home folder is the usual starting point when you open CMD window.
In Mac OS you will usually find the Terminal in Other programs folder. When you open the terminal, you will see the name of the current folder. If you want to know the full path to the current folder, you can type pwd and see the full path.
List files and folders
If you want to list files and folders in that directory use:
WINDOWS | MAC OS |
---|---|
dir | ls |
Here you see the list of directories in my home folder
- Listing files in a directory with dir command in Windows CMD
Move to directory
If you want to change your current directory to another directory, use:
WINDOWS | MAC OS |
---|---|
cd “path to the folder” | cd “path to the folder” |
When you execute the command by pressing “enter” in your keyboard, if the path is correct, you will see that you current folder will change to the new path.
Get back to parent directory
If you want to go one directory up in the directory tree, execute:
WINDOWS | MAC OS |
---|---|
cd.. | cd .. |
and you will see your current directory will change to the parent directory. Please note that in windows two dots are connected to cd, and in MacOS there is a space between cd and dots.
Get to the root
Wherever you are in the directory tree, you can move to the root directory by executing:
WINDOWS | MAC OS |
---|---|
cd | cd / |
Best Commands For Mac Terminal
This will get you to the disk root of the directory tree.
Create a directory
Creating a new directory is done using
WINDOWS | MAC OS |
---|---|
mkdir MyFolder | mkdir MyFolder |
This will create directory MyFolder in your current directory.
Remove a directory
Removing a directory first requires the directory to be emptied from contents, and then be removed. Removal commands are:
WINDOWS | MAC OS |
---|---|
rmdir MyFolder | rm -r MyFolder |
Rename a directory
To rename a directory execute:
WINDOWS | MAC OS |
---|---|
rmdir | mv oldName newName |
Rename a file
To rename a file execute:
WINDOWS | MAC OS |
---|---|
ren oldFileName newFileName | mv oldFileName newFileName |
Delete a file
To delete a file exeute:
WINDOWS | MAC OS |
---|---|
del filename | rm -Rf filename |
Delete command does not ask for confirmation, so please be careful.
Check the Path
Some programs need to be added to the PATH in order to be accessible through command line interface. If you want to check your current path, you can execute the following command:
WINDOWS | MAC OS |
---|---|
echo %path% | echo “$PATH” |
This will print current path variable and you can check if required programs are added to the path.
I hope this helps.
I hope this helps.
If you’re working in Terminal on your Mac, you need to know the most important UNIX commands: those that work with directories, those that work with files, and miscellaneous but commonly used commands.
Folders are called directories in UNIX. Commands that refer to filenames, as most do, assume that you’re talking about files in the working directory. When you open the Terminal window, the working directory is set to your home directory, abbreviated ~. Bash shows you the current working directory and your username to the left of its prompt. The following table lists common directory-related commands.
Terminal Network Commands For Mac
Command | What It Does |
---|---|
ls | Lists the names of the files in the working directory. For more complete information, use ls –alF (. |
cd directoryname | Changes the working directory to the one you named. |
cd .. | Brings you up one directory level. |
cd | Returns you to your home directory. |
pwd | Displays the pathname of the current directory. |
mkdir newdirectoryname | Makes a new directory. |
rmdir directoryname | Removes (deletes) an empty directory. |
As in Windows, you can redirect the output of a command to a text file. So if you want a record of the files in a folder, type cd, followed by a space, drag the folder’s icon to the Terminal window, and press Return. Type ls > mydirectorylist.txt and press Return again. A file named mydirectorylist.txt will appear in the folder you chose. You can open the file in TextEdit to see a list of the files in that directory.
This table lists commands commonly used when working with files in the Terminal window.
Command | What It Does |
---|---|
cp filename1 filename2 | Copies a file. |
chmod | Changes permissions for access to a file. Study the man page before using this one. |
diff | Compares two files line by line (assumes text). |
more filename | Displays a text file one page at a time. Press the spacebar to see the next page; press Q to quit. The man command works through more. |
mv filename1 filename2 | Moves a file or changes its name. |
rm filename | Removes (deletes) a file. |
This last table explains other handy commands that anyone getting started in Terminal will likely want to know.
Command | What It Does |
---|---|
Control+C | Terminates most operations. |
date | Displays the current date and time. |
echo | Repeats whatever appears after the command (after expansion). |
help | Displays a partial list of bash commands. |
history | Displays the last commands you typed. You can redo a command by typing an exclamation point (!) followed immediately (no space) by the number of that command in the history list. To repeat the last command, type !!. To repeat the last filename, type !*. |
pico | A simple UNIX text editor. |
ps | Displays a list of running processes. |
sudo | Lets you carry out commands for which the account you are using lacks authority. You will be asked for an administrator’s password. |
Terminal Commands For Mac Os
When you’re working in Terminal, you don’t have a Trash Can to which deleted files are moved pending ultimate disposal. Delete it, and it’s gone. In general, UNIX has no Undo function.