Welcome to Team5 Unix Live

The Basics

Linux Basics

Basic Linux Commands

To navigate Linux, we will be using the terminal. All operating systems have a shell that allows interaction with the computer. Windows has a graphical shell or a GUI (graphical user interface) that allows users to change programs or settings graphically. Although changing the settings on a GUI is simple, it uses more resources from your computer and some settings are very limited. Linux, however, uses a command-line shell that allows users to change settings with just the keyboard. While it is not fancy, using the command line allows more flexibility and greater customization, as compared to its GUI counterpart. This chapter will show you the basic commands to navigate through Linux.

“Print Working Directory” shows where you are in the file system.


pwd
pwd

List Directory Contents shows contents of the current directory.


ls [options] [location]
ls

The –L option shows a long listing variant of ls and has 7 fields.


ls -l
ls-l

  • The first letter indicates if the content is a file (-) or directory (d). The nine letters following are the permissions (We will go over this in Chapter 4).
  • Number of links to the file/directory. (All directories should have at least two. A Link to the parent directory, and a link to itself.
  • User who is the “owner” of the file.
  • User group the file belongs to.
  • File size, in kilobytes.
  • Last time the file was modified.
  • Name of the file or directory.

You can combine multiple options with each other. For example, ls -la will show a long listing of all the contents, including hidden items. Hidden items have a “.” in front of the name.


ls -la
ls-la

Change Directory allows the user to change their working directory, or location in the file system.


cd [location]
cd

Here are a few shortcuts you can use to better your experience:

  • (~) - link to home directory.
  • (.) - current directory.
  • (..) – back-up one directory in the hierarchy, or previous directory.
You can also press the “Tab” key to autofill.

Manual pages provide documentation on the supplied command.


man [command]
man < Last Lesson Chapter Quiz >