This is the introduction to the basic shell commands.
Home Page Collection of TutorialsOverview
Time estimation: 2H
Version: main
Last update: 2025-11-28
QuestionsObjectives
What is a command shell and why would I use one?
How can I move around on my computer?
How can I see what files and directories I have?
How can I specify the location of a file or directory on my computer?
Describe key reasons for learning shell.
Navigate your file system using the command line.
Access and read help files for
bashprograms and use help files to identify useful command options.Demonstrate the use of tab completion, and explain its advantages.
This tutorial will help you develop proficiency in the necessary Unix shell concepts.
On Unix, every user has a unique user name. When they log onto the system, they are placed in a home directory, which is a portion of the disk space reserved just for them. When you log onto a Unix system, your main interface to the system is called the Unix Shell. This is the program that presents you with the dollar sign ($) prompt. This prompt means that the shell is ready to accept your typed commands. It is often preceded by the user name as well as the current directory.
Unix commands are strings of characters typed in at the keyboard. To run a command, you just type it in and press the Enter key. We will look at several of the most common commands below.
Commands often have parameters, e. g. a file to work on. These are typed in after the command and are separated by spaces, e. g. less pi_results.txt opens the file pi_results.txt for reading.
In addition, Unix extends the power of commands by using special flags or switches. Switches are usually preceded with a dash (-), e. g. ls -lh.
List of commands
Command Description pwdprint current (working) directory lslist contents of the current directory ⤷ -llong (detailed) listing ⤷ -hwith human readable numbers cdchange to another directory mkdirmake a new directory mvmove or rename a file or directory cpcopy file ⤷ -rcopy directory tree (recursively) filedetermine file type echoprint a line of text headView the first 10 lines of a file sortSort lines of text files lessdisplay contents of a file (press q to quit) tailoutput the last part of a file ⤷ -ffollow appended data as the file grows greplist text lines containing a particular string of text ⤷ -voutput only non-matching lines wccount lines, words, and bytes in a file catconcatenate (combine) two or more files dfshow disk free information ⤷ -hwith human readable numbers findfind files in a directory tree mandisplay program manual for a command ps -xlist one’s own running programs / processes (extended list) killkill process ⤷ -9kill process immediately (SIGKILL=9) rmremove a file ⤷ -rremove a directory tree (recursively) rmdirremove an empty directory chmodchange mode (security permissions) of file or directory ⤷ ugo+-rwxuser (owner), group, other (world), add(+), remove(-), read, write, execute ./myprogramrun the local executable file myprogramsed 's/ab/cd/'transform text, e. g. replace all occurrences of ‘ab’ with ‘cd’ nanoCommand line text file editor ⤷ Ctrl-xBy using the key combination Ctrl-xin the editor, you can exit the editor and optionally save the file.wgetnetwork downloader (downloads files from the Web) gzipcompress a file gunzipuncompress a file *wildcard representing any combination of characters Places ~your home directory .current directory ..parent directory Pipes >send output to a file >>append (add) output to a file \|pipe output from one command as input to another
During this tutorial you will use many of the commands above. Your task is to identify the correct commands and execute them. Feel free to experiment. Take a look at the solution if absolutely necessary.
This tutorial is based on the tutorial that was created by the de.NBI Cloud Bielefeld administrators. The first two sections (01 and 02) describe how to access the workshop environment for this tutorial. Participants need a web browser and an active ELIXIR account.
{ % include _tutorials/unix-course/main/part1.md %}
{ % include _tutorials/unix-course/main/part2.md %}
{ % include _tutorials/unix-course/main/part3.md %}
Key Points
The shell gives you the ability to work more efficiently by using keyboard commands rather than a GUI.
Useful commands for navigating your file system include:
ls,pwd, andcd.Most commands take options (flags) which begin with a
-.Tab completion can reduce errors from mistyping and make work more efficient in the shell.
Contributions
Author(s): Christian Henke, Peter Belmann, Jan Krueger, Nils Hoffmann, Sebastian Juenemann, Viktor Rudko