So, you want to join a public-access shell community like tilde.team, but you don't yet have experience using GNU+Linux or other UNIX-like operating systems? This tutorial is designed to give you enough guidance that you can get started and move on to successfully directing your future learning. Once you get a basic level of self-sufficiency, tilde.team is a great place to practice and learn more.
You'll find a lot of people online arguing that GNU+Linux is _not_ a text-based operating system, and that it in fact has a GUI interface just like Windows. It is true that you can use GNU+Linux through a graphical user interface (GUI) like Gnome, or that you can use services from GNU+Linux servers like tilde.team through a web interface. But the people who are so keen on GUIs are saying this to make GNU+Linux sound like an easy transition for Windows or Mac users. However: (1) to really leverage the power of GNU+Linux, you need to learn to interact with it as a text-based system, and (2) while it is different, it's not really that hard. It will take effort to learn the differences, but that effort will pay huge dividends.
The most common way to connect remote GNU+Linux system is with an SSH client. SSH stands for secure-shell. SSH allows you to make a private connection between your computer and a shell server like [tilde.team](https://tilde.team), and it ensures that nobody else along the wire can listen in on your connection. Check out [our SSH page](https://tilde.team/wiki/ssh) for information on connecting to tilde.team over SSH.
If you are having trouble with making your first SSH connection to tilde.team, or anything else while you're learning from this tutorial, drop by the [tilde.team web chat](https://web.tilde.chat/) or email an admin for help ([sudoers@tilde.team](mailto:sudoers@tilde.team)).
An operating system (OS) is the nuts and bolts that makes all the parts of your computer work together for you. At its core, the OS is not friendly for day to day computer usage. A shell is a user friendly "wrapper" around the operating system that allows you to use it easily. A shell can be graphical, like the Windows or Android GUIs. Or a shell can be text-based. A text based shell, also called a command line interface (or CLI), is a tool you can use to control the operating system by sending it text commands.
What kind of things can you make the OS do? Things like opening files, listing the files in a directory, displaying the current system load, or telling you what other users are currently doing.
Commands are simple words, often abbreviated, that make the system do things when typed into the shell. Some simple examples are 'ls' which lists the files in a directory, or 'cd' which changes your location to a new directory (cd = change directory), or 'exit' which logs you out of your current shell session. There are thousands of useful commands, but you only need to know a few to get started and be self-sustaining.
This tutorial will teach you the few commands that should allow you to take care of yourself and start down the real, longer-term path of self-directed learning. Once you're logged into tilde.team (or any GNU+Linux shell server), you can practice the following commands as you learn them.
When you're logged into a shell, you should see a command prompt and a blinking cursor. At this point, simply type a command and hit Enter to run it. You can try this as you work through learning the commands below.
Recall from the How-Do-I-Connect section above that you can use a SSH client to log into tilde.team. Once you're logged in, you can use the command line SSH client to log into any other shell server; in the example below, let's say you want to log into tilde.town from tilde.team.
Some shell servers allow you to log in with nothing more than a username and password. But increasingly, many servers (like both tilde.team and tilde.town) require you to use ssh keys. To learn more about ssh keys, again, see our [SSH page](ssh).
You may move from one directory to another with `cd`. Wherever you are in the file system, you can type `cd` by itself to return to your home directory:
If you're still in your public_html directory, you should see a file called 'index.php' when you use the `ls` command. Let's peek inside 'index.php' as follows:
`less` has opened the 'index.php' file for you to read. You cannot edit it; only read it. Type `q` (quit) to stop viewing the file contents and return to the shell.
`nano` is one of many text editors availble for GNU+Linux. There are many more powerful editors, but we'll start with this one because it is simple. Let's open your 'index.php' file and make some changes.
Now you're viewing the contents of 'index.php' again, but this time you can change the contents. If you don't know HTML, be careful here. Use your arrow keys to move the cursor down to the line that says the following:
Now, add some quick contents by opening the file for editing with `nano`, and adding whatever you want. Then Ctrl+x to save, you will have created a new file.
First, hop back to your home directory with the `cd` command (remember that `cd` from anywhere in the file system will take you back to your home directory).
Now create a new directory called 'downloads' in your home directory:
Now if you `ls` the contents of your home directory, you will no longer see 'fileone.txt', because it has been moved into 'downloads'. If you 'ls' the contents of 'downloads' (a shortcut command is `ls downloads`), you will see it there.
Now if you `ls` the contents of your home directory, 'filetwo.txt' will still be there. This is because `cp` made a copy of 'filetwo.txt' and put the copy in 'downloads'. It did not touch the original file in your home directory. Verify this with `ls` in your home directory and in 'downloads'.
As long as you're in one of your own directories (e.g. your home, or 'downloads' or 'public_html'), you can create a new files. Create a new file called 'testtrash.txt':
Notice that you don't get a warning that you're about to delete it, and you don't even get a confirmation that it is deleted. You've learned your first command that you need to be careful with. If you delete an important file with `rm`, it is gone forever.
You can delete directories the same way, only using the `rmdir` command (remove directory) instead of `rm`. If you use `mkdir testtrash`, you can then delete it as follows:
Be very, very careful with this command. Many a user, new and seasoned, has been stung by hastily deleting directories like this. This is also the source of the classic sysadmin joke/horror story about `rm -rf /` which deletes the entire file system.
You will see output of the command that confirms it is downloading. You can also verify that it has downloaded with your `ls` command. You can also peek at the contents with the `nano` or `less` commands that you learned above.
If you know the URL of other files you'd like to download, you can grab those too, just swapping the URL above for any URL:
> `wget [URL here]`
A brief note on security here, if you do pull any scripts from the Internet using `wget`, it's important that you do not execute those scripts until you've read over what it does. Otherwise, you run the risk of compromising your account or allowing other malicious actions to take place.
At this point, you've learned most of the commands you need for basic self-sufficiency in a GNU+Linux shell environment. With just a few more, you can go a long way. When you want to learn more about a command, you can look at its "man page" with the `man` command. "Man pages" are the instruction manuals for most commands and programs in GNU+Linux.
Try out `man` by looking at any of the commands you've learned already (except `cd`\*). For example, `man ls` would open the man page for the `ls` command. When looking at a man page, type `q` at any time to quit and return to the shell.
The `man` command will be one of your most valuable tools for as long as you're using the GNU+Linux shell. You will always be learning new commands and new ways to use old commands, and `man` will help you do it.
\* Note: technically speaking `cd` is a shell built-in, not a command. Make a mental note of that and you can learn more about the distinction later. For now, note that you can use `help cd` to learn more about the `cd` command.
When you look at the man page for a command like `ls`, you'll see in the DESCRIPTION section a number of **options** that you can use to modify how the command works. They look like `-a` or `-h` or `-l`. Try adding the `-a` option to `ls` and note the difference:
The `-a` option now lists "all" contents of your directory, including "hidden" files (aka dot files). You could combine the three options listed above in the form of `ls -alh` to list "all" files, in "long" form, and display file sizes in "human" readable format. Most commands have
Commands also have **arguments**, or information passed into a command for some kind of processing. You have already used these arguments when you told nano to open a file: `nano testtrash.txt`. In this case, "testtrash.txt" was the argument to the nano command. You also used "testtrash.txt" as an argument to the `rm` command when you did `rm testtrash.txt`.
You already know that you get dropped into your "home" directory when you first log in. Your home directory is just one of many, many other directories on the system. All of these directories are organized under one master directory called the "root directory". The root directory is often referred to with a single forward slash, like this: /
Want to check out some of the directories you see in root? You could either `cd` into them and `ls` the contents, or just `ls` the comments directly as follows:
This would display the contents of the "etc" directory, which itself lives in the "root" directory. Notice that the command uses "/" + "etc" to create a path to the destination. In "etc" is another directory called "cron.d", and you can use the same principle to view its contents:
You now know enough to look around the file system. Note that most GNU+Linux systems (like tilde.team) adhere somewhat to an organization scheme called the Filesystem Hierarchy Standard ([Wikipedia link](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard)). This is another subject for you to read up on later.
As you explore the filesystem, you might bump into some directories that won't let you in. For example, if you try to `cd` into the home directory for the root user (not the same as the root directory), you'll see this error: "/root: Permission denied". This is because GNU+Linux systems maintain a "mode" for each file that limits which users can read, write or execute it.
If you don't own a file, then you can't change its mode. This is a basic security principle in GNU+Linux systems.
For the files you own (i.e. the files within your home directory), you can change the file modes yourself. You do this using the "change mode" command, `chmod`.
Each file has three permission levels: for the file owner, for members of the file's group\*, and for all other system users. For each level, you can permit any combination of "read", "write", and "execute" permissions.
You can change a file's mode with `chmod` one of two ways. The first is a symbolic way in which you add or subtract 'r', 'w', and/or 'x' (read, write, execute) to 'u', 'g', or 'o' (user, group, or other). For example:
Finally, remember that 'testing.html' file we made above? Let's use that as an example of how you can control who can view your files. Use the following to make the 'testing.html' file visible in your website:
tilde.team is about community, but it is about community of individuals who work hard to learn. what you have just leaned will give you a platform on which you can learn by doing and trying things out.
Below are some other common programs you'll likely want to use. Most of these have man pages, so you can read more about them. Others you'll just have to try out to see how they work.
`wget`, `curl` - for grabbing files from elsewhere
`weechat`, `irssi` - for irc
`scp` - for securely moving files between networked systems. this copies files (i.e. 'cp') over ssh, hence 'scp'
`lynx` - web browsing
`cron` - scheduling recurring jobs (job = sequence of commands, often stored in a script)
`dict` - dictionary for definitions and synonyms
`aspell` - a program for spell checking
`motd` - list the message of the day, which on tilde.team displays all the other commands below
## some tilde.team specific programs
`bbj` - a bulletin board for asynchronous discussions
`tilde` - a manager for user-submitted scripts
`webirc` - register for [thelounge](https://irc.tilde.team) webchat (in case you don't like weechat or irssi, or want to get push notifications for mentions and query messages :)
`chat` - open `weechat` preconnected to our irc
## Some shell use cases
And in this corner, we shall describe some common activities people perform in a shell... [Feel free to add here.]
Not suprisingly, you'll find a lot of other intro material online or in your local library. Here are a few that have been mentioned by tilde.team members: