Although Linux generally has a default windows-like environment, you'll find that a lot of the more techie stuff is done at the command line, in a 'terminal', interacting with a scripting environment called a 'shell'. Command line / terminal / shell prompts are generally available under the application / start menu, though you can set up the system to boot to these rather than automatically starting X Windows.
The different shells have their pros and cons. 'Bash' (the Bourne Again SHell) is simple to use and comes with a simple scripting language but if you are familiar with Java you may find C-scripting in the C Shell (TC on Linux) simpler.
You can change shells at any time by typing the shell name (e.g. 'bash' or 'tcsh'), or you can change your default shell - look at the documentation on user profiles for your OS.
Navigation of the Linux file systems is much like command line navigation of DOS systems, though Linux uses forward slashes, not backslashes. Here are some commands that are useful.
cd / | Changes directory to the root/bottom of the file system. |
cd .. | Takes you down a directory. |
cd name | Takes you up a the directory 'name'. |
ls | List directory contents. |
./ | Refers to the current directory |
pwd | List the path of the current directory (print working directory). |
mount/umount | Used for mapping drives. |
Examples | |
cd /home/user1 | Go to root then up to home/user1. |
cd ../../dir1/dir2 | Go down two directories then up two. |
Usually you run software through X Windows. If you want to use the command line, type the name of the application. If it is in the PATH environment variable (set up in the profile of each user) the system will find it. If not, list the path to it first. In the current directory you can use ./ to say "look in this directory", e.g.: ./myProgram.exe.
Programs can be (aggressively) shut down at the command line by typing CTRL-C (i.e. holding down the CTRL key and typing C).
Help for software is usually available in the form of the (sometimes obscure) 'man' (manual) pages. To get these, type "man" followed by the software name at the command line to open these. Press enter to scroll through the page, and CTRL-C to quit.
By default, running a program will hang the command prompt. To run a program in the background from the command line use &:
& myProgram
To see running jobs use:
ps
This will list programs, each with a PID number.
To stop a program use '
kill 124
There are a large number of software repositories from which you can install software. A popular one for Linux is the GNU (Recursively stands for "GNU is not UNIX") archive. GNU is an Open Source effort to make software for UNIX-style systems.
Most software now comes packaged for an installation manager called apt. It is simply a matter of supplying the name of the software you want to apt-get (note here the use of sudo):
sudo apt-get install softwarename
Alternatively, some software installs using a system called "gems" which is similar but for software written in, or with installers written in, the language Ruby (details).
Updating with apt is also very simple:
sudo apt-get update softwarename
If the software isn't packaged like that, it may come with some kind of install script you need to adapt, often a make file.
For software that you need to download, a simple way to download it is with wget:
wget http://www.etc.com/filename
Usually this will be downloaded as a compressed tar file(.tar.gz), which bundles a bunch of files together. To extract:
tar xvzf filename
Move into the directory produced and configure for your system:
./configure
Then make:
make install
If they don't work, they're pretty horrible to sort out.
Here's a few other useful file commands:
cp file1 file2 | copy file1 to file2 |
rm file1 | remove file1 |
touch file1 | create an empty file1 |
mv file1 file2 | move(rename) file1 to file2 |
find directories -name file1 | find file1 |
tar, gzip, gunzip | file bundling and compression |
There are a few useful elements that join commands together at the terminal:
| (the pipe symbol: SHIFT-Backslash usually) pipes (sends) output from one program to another.
more filename lists a file a screen at a time.
Together they are quite often used to display on the screen in a controlled way that doesn't scroll crazily:
myprogram | more i.e. pipe the output of the program to 'more'.
">" redirects the output of a program to a file:
myprogram > filename
">>" appends rather than overwriting.
The cat program is use for listing file contents and concatinating them, but also for generating files from standard in (the keyboard).
cat file1 >> file2 adds file1 to the end of file2.
cat > file3 records keyboard to file3 until CTRL-C pressed.
head | Lists beginning of files. |
tail | Lists end of files. |
grep | Complex script toolkits for text |
auk | search and processing |
sed | text processing |
*nux users classically used one of two text editors: "vi" or "emacs". vi is an esoteric editor controlled by key combinations, whose one redeeming feature is that it is pretty much always installed on UNIX systems. Linux has 'vim', an enhanced version. It is worth at least keeping a list of commands to hand as some system tools use this as the default editor (e.g. crontab - see Linux admin). Emacs is similar, but with a much enhanced functionality, included everything from games to compilers. You would be suprised (or manybe you wouldn't) how angry people get about which is better. If you're a beginner used to Notepad, they're both pretty awful. Fortunately most Linux distros now come with a variety of Notepad-style text editors. If you actually want to word process, much better is the full office suit Open Office, which includes standard work processing, spreadsheet, and presentation software. It is a bit like Microsoft Office, but free. It's compatible with MS Office and available for Windows.
Other classic *nix software includes GIMP (for images and graphics); the Postgres database, and the Apache webserver.