Beginner guide
In ten minutes you read the prompt, move between folders, create a file, edit it, open a second tab and learn where the help is. No Linux experience is needed.
What you need
- Ubuntu Terminal installed or the portable file. See Install.
- A keyboard. Everything here is typed.
Read the prompt
Open Ubuntu Terminal. After a welcome line you see the prompt:
you@pc-name:~$| Part | Meaning |
|---|---|
you | Your Windows user name |
pc-name | The name of your PC |
~ | The folder you are in. ~ is short for your user folder, such as C:\Users\you |
$ | The terminal is ready for a command |
You type a command after the $ and press Enter. The terminal prints the result and shows a new prompt.
Look around
Type
pwdand press Enter. It prints the folder you are in.Type
ls. It lists the files and folders there, in colour.Type
ll. It lists the same things with details: size, date, and hidden files whose names start with a dot.Type
cd Documentsto go into your Documents folder. The prompt changes to~/Documents.Type
cd ..to go back up one level. Typingcdon its own always returns to your user folder.
TIP
Press Tab to complete a file or folder name after typing its first letters. Press the up arrow to bring back the previous command.
Make a folder and a file
Create a practice folder and go into it:
bashmkdir practice cd practiceCreate a file with one line of text. The
>sends the output ofechointo a file:bashecho "hello from the terminal" > notes.txtShow the file's contents:
bashcat notes.txtCopy it, then rename the copy:
bashcp notes.txt backup.txt mv backup.txt old-notes.txt lslsnow showsnotes.txtandold-notes.txt.
These are ordinary files in C:\Users\you\practice. You can see them in File Explorer too.
Edit the file
The editor is vi. It has two modes: one for commands and one for typing. That surprises everyone the first time, so follow these keys exactly.
Open the file:
bashvi notes.txtPress i to start typing. Type some text.
Press Esc to stop typing.
Type
:wqand press Enter to save and leave.
To leave without saving, press Esc, then type :q! and press Enter. More in Edit files with vi.
Open a second tab
Press Ctrl + Shift + T, or select the + button at the top right. A new tab opens in your user folder.
Click a tab to switch to it. Each tab is a separate terminal.
Press Ctrl + Shift + W, or select the × on a tab, to close it.
Copy and paste
In a terminal, Ctrl + C stops the running command. So copying uses a different shortcut:
- Select text with the mouse, then press Ctrl + Shift + C to copy.
- Press Ctrl + Shift + V to paste.
Clean up
Remove the practice folder and everything in it:
cd ~
rm -rf practiceDANGER
rm deletes at once. Files do not go to the Recycle Bin and cannot be restored. rm -rf deletes a folder with everything inside it without asking. Check the name, and the folder you are in, before you press Enter.
Get help
Type helpme for a short list of the commands that work. Most commands also explain themselves when you add --help, for example cp --help.
What you learned
- The prompt shows who and where you are.
ls,cd,mkdir,cp,mv,catandrmcover most file work.viedits files: i to type, Esc, then:wqto save and leave.- Tabs give you several terminals in one window.