Facebook Twitter YouTube Flickr Google Plus
Basic Linux Help

Basic Linux Help

This page is meant to help you gain a basic understanding of how to use our Linux servers to their full potential.

Open Source Philosophy

Ubuntu is a freely distributable open source project. Open source software allows anyone to look at the source code of an application, make changes to the source code, and redistribute the software.

Terminal(Command Line)

While many things can be done in Ubuntu with a graphical User Interface, a terminal is an essential tool for any power user or developer to learn. While it may be difficult for a newcomer to master, the terminal has some huge advantages:

  • Scripts and applications can be written to interact with a computer.
  • All the features of an application can be accessed.
  • Many administrative tools are available from the terminal only.
  • It is faster, after you know how to do something.

There are two basic kinds of information you will need to use a terminal:
  1. You will need to know how to use a command.
  2. You will need to know which command, or application to use to do something.
Search engines are very good resources for finding this information, However it is convenient to be able to learn how to use the terminal from the terminal. Luckily there are some useful tools for that.

Using Help and Man:

When you need to know how to use a command type --help after the command for a brief help file on how to use the command. If you need more information type man followed by the command. For example to learn about the ls command, which displays the items in the current directory, I would type
$ ls --help
or for more details
$ man ls
NOTE: do not type the $, it is just standard notation for a terminal. To Exit from the man pages hit "q".

Using Apropos:

There is also a terminal solution for when you don't know the name of the command to use but you know what you want to do. The command for this is apropos. So for example if you wanted to know how to change to list the contents of a directory you would type:

$ apropos "list directory"

For more information on apropos type man apropos. 

Using Pipe:

To really utilize the terminal especially for tools like apropose that return lists, piping is a key concept to understand. Try this tutorial. You can now do more advanced apropos searches. For example:
$ apropos "print current directory"
AND
$ apropos print current directory
do not give me the results I want. If I use piping like this
$ apropos print | grep current| grep directory
I now see that the command pwd is the command i was searching for.

Using Screen:

Sometimes you need to complete a long task on a Linux machine, but you don't want to sit around in the lab waiting for it to finish, or have you ever wanted to start a job from home, so by the time you drive to campus it will be complete? We can do this using a tool called Screen.

Screen is like a window manager for your terminal. Unlike a virtual terminal, screen allows you to detatch from a terminal. While detached, the program you were running continues to run. You can then reattach later and continue your task. This is useful if you want to run a bunch of tasks but don't want to keep an ssh session open or if you lose your connection.

We highly recommend that SECS Linux students are proficient with screen so that you can run jobs without having to be logged into a terminal. First, let's login to a Linux machine, we can do this by opening a terminal if you're in a lab or remotely by using ssh
We're going to launch Matlab, but we're going to use screen with it:
$ screen matlab
Matlab will launch, except that it's running in screen. Now that you've got something running on the remote host, and we want to detatch it (it will still be running, but your terminal windows will be free). Hit CTRL-a, then d (Case sensitive). You are now detached. The process you were viewing run is still running... you can confirm this with ps -a.

You can now logoff, yet the program continues to run on the remote host even though we're not connected to it. To reattach, ssh back into the remote host and at the prompt type screen -rD. Screen will return you to where you left off.

This is a simplistic example, you can read the full documentation for screen from the manpage:
$ man screen

Privileges

Files and applications have permissions associated with them. When you log into Ubuntu you are given only basic privileges. Sometimes when you try to do something like install an application or open a file you will get a permissions error. To run a command with ROOT privileges simply type sudo before a command. You will then be prompted to enter your password. It is the same password you logged into the machine with.

To view the permissions settings on a file or directory, from the parent directory type:
$ ls -l
The results will be something like:
-rwxrwxrwx or drwxr-s---
To Understand this you will need to understand the basic concept of linux file security. Each file has a user and a group who have ownership of it. these are also displayed with the ls -l command. Here is a sample return:
-rw-r--r-- 1 someusername root 12738 2009-06-05 15:03 dump.sql
In this example someusername is the user and root is the group associated with this file. The user and group can be altered using the chown command. Now I can explain the first part of the ls-l result which is the permisions section. In the example above it is '-rw-r--r--'.
  • The first character can be a 'd' or a '-' or a 'l', representing either a file (-) or directory(d), or a link(l) 
  • Then there are 3 sets of 3 character. 
    • Each of these characters are binary and can be either a letter representing an allowed permission or a '-' representing no permission granted. 
    • The possible permissions are read, write, and execute. 
    • There are 3 groups that have permission assigned to them, the user, the group, and others. 
      • First the permissions for the user are given, followed by the group, followed by the permissions for all.

Installing Software

To install software on an Ubuntu desktop or server us the apt-get command. Here is a nice introduction at https://help.ubuntu.com. To find the current version inside terminal type check here for more information.


AcademicsUndergraduate AdmissionsGraduate AdmissionsOnline ProgramsSchool of MedicineProfessional & Continuing EducationHousingFinancial Aid & ScholarshipsTuitionAbout OUCurrent Student ResourcesAcademic DepartmentsAcademic AdvisingEmergenciesFinancial ServicesGeneral EducationGraduate StudiesGraduation & CommencementKresge LibraryOU BookstoreRegistrationAthleticsGive to OUGrizzlinkAlumni EngagementCommunity ResourcesDepartment of Music, Theatre & DanceMeadow Brook HallMeadow Brook TheaterOU Art GalleryPawley InstituteGolf and Learning CenterRecreation CenterUniversity Human ResourcesAdministrationCenter for Excellence in Teaching & LearningInstitutional Research & AssessmentInformation TechnologyReport a Behavioral ConcernTrainingAcademic Human Resources
Oakland University | 2200 N. Squirrel Road, Rochester, Michigan 48309-4401 | (248) 370-2100 | Contact OU | OU-Macomb