tutorials:2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tutorials:2 [2023/04/03 11:49] – tcmal | tutorials:2 [2023/07/29 11:18] (current) – removed tcmal | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 2. Using the command line ====== | ||
- | |||
- | |||
- | When you log in via SSH, you are presented with the command line interface, by means of the shell. | ||
- | The current default is Bash. Bash stands for " | ||
- | A shell is is what interprets what you type into the prompt and makes things happen - different shells do things differently. | ||
- | Your default shell is bash, although you can change it if you wish, but this document will only give you a brief introduction to using the shell to run programs and use the filesystem. | ||
- | |||
- | ===== The Prompt ===== | ||
- | |||
- | |||
- | The first thing you should notice is that your shell puts something at the start of every line. This is called the prompt and it looks something like this: | ||
- | |||
- | < | ||
- | tcmal@sontaran: | ||
- | </ | ||
- | |||
- | The default prompt tells us our username ('' | ||
- | |||
- | We can enter commands after the prompt, hit enter, and once they' | ||
- | |||
- | < | ||
- | tcmal@sontaran: | ||
- | tcmal | ||
- | tcmal@sontaran: | ||
- | sontaran.tardisproject.uk | ||
- | tcmal@sontaran: | ||
- | /home/tcmal | ||
- | </ | ||
- | |||
- | |||
- | While you're at your prompt, you can also use the arrow keys to scroll back up your command history, and Ctrl+R to search through it. | ||
- | |||
- | ===== Moving around ===== | ||
- | |||
- | As mentioned above, our current directory is shown at the start of our prompt. You'll almost always start off in '' | ||
- | |||
- | We can use '' | ||
- | |||
- | < | ||
- | tcmal@sontaran: | ||
- | tcmal@sontaran:/ | ||
- | tcmal@sontaran: | ||
- | </ | ||
- | |||
- | This is more interesting if we make some directories, | ||
- | |||
- | < | ||
- | tcmal@sontaran: | ||
- | tcmal@sontaran: | ||
- | tcmal@sontaran: | ||
- | tcmal@sontaran: | ||
- | tcmal@sontaran: | ||
- | / | ||
- | tcmal@sontaran: | ||
- | tcmal@sontaran: | ||
- | </ | ||
- | |||
- | '' | ||
- | |||
- | We can use '' | ||
- | |||
- | < | ||
- | tcmal@sontaran: | ||
- | tcmal@sontaran: | ||
- | test2 test3 | ||
- | tcmal@sontaran: | ||
- | total 16 | ||
- | drwxr-xr-x 4 tcmal 1004 4096 Oct 26 22:49 . | ||
- | drwxr-xr-x 7 tcmal 1004 4096 Oct 26 22:49 .. | ||
- | drwxr-xr-x 2 tcmal 1004 4096 Oct 26 22:49 test2 | ||
- | drwxr-xr-x 2 tcmal 1004 4096 Oct 26 22:49 test3 | ||
- | </ | ||
- | |||
- | As well as // | ||
- | In '' | ||
- | |||
- | Now that we know how to make directories, | ||
- | |||
- | < | ||
- | tcmal@sontaran: | ||
- | tcmal@sontaran: | ||
- | tcmal@sontaran: | ||
- | </ | ||
- | |||
- | Note that we gave '' | ||
- | |||
- | When we call '' | ||
- | The recursive flag is needed when you're deleting directories - like most long flags there is a corresponding short flag, so we could have said '' | ||
- | |||
- | ===== Learning how to use programs ===== | ||
- | |||
- | The best way to learn how a program works and how to use it is by reading the man page (manual page) built into the system about that program. To find out what a program does and how to use it, simply type man [program name]. Try it now -'' | ||
- | |||
- | This takes us away from our shell and into a **pager**. You can scroll up and down using up and down arrows, page up and page down, and space and return. Don't worry if you don't understand everything written there, you're not expected to memorize all of a program' | ||
- | |||
- | ===== Finding a program for your purpose ===== | ||
- | |||
- | If you know what sort of program you want to run, but aren't sure of the name (or if such a program exists), you can use **apropos** to search for a program by function. For instance, say we want to find an IRC client but we don't know the names of any. We type: '' | ||
- | But we get quite a lot of matches, most of which are no use to us. This is because the search has turned up a load of results where " | ||
- | |||
- | Yay, we've narrowed our matches down to what we wanted! Alternatively we could have tried '' | ||
- | |||