The Coders Computer
Command Line
What is Command Line? It is a text interface for your computer. It’s a program that takes in commands, which it passes on to the computer’s operating system to run. From the command line, you can navigate through files and folders on your computer.
The command line typically presents you with a prompt. As you type, it will be displayed after the prompt. Most of the time you will be issuing commands.
Operating a Terminal (Command Line)
- Mac OC
- Find the program Terminal under Applications -> Utilities. An easy way to get to it is the key combination ‘command + space’ which will bring up Spotlight, then start typing Terminal and it will soon show up.
- Linux
- Find it in Applications -> System or Applications -> Utilities. Alternatively you may be able to ‘right-click’ on the desktop and there may be an option ‘Open in terminal’.
- Windows
- You will need an SSH client. A rather good one is Putty (free).
Basic Commands
- pwd
- Print Working Directory - tells you where your current working directory is
- ls
- List - shows you a list of files in the current directory
- ls -a
- List - shows you all files in a directory including hidden files
- cd
- Change directory. If you run the command cd without any arguments then it will always take you back to your home directory.
Passes
There are 2 types of paths we can use, absolute and relative.
Absolute paths specify a location (file or directory) in relation to the root directory. You can identify them easily as they always begin with a forward slash ( / ).
Relative paths specify a location (file or directory) in relation to where we currently are in the system. They will not begin with a slash.