Linux Command Line Basics Part I: the Unix File Structure

Knowing basic *nix terminal commands is an absolute must for any computer pro. Whether you use Windows, Mac OS or Linux, you’re bound to face the command prompt at some stage, so here’s my crash course in CLI. Part 1 covers the basics of the file structure to get you familiar with the space you’ll be working in.

The Unix File Structure

Familiarity with the Unix file structure is important if you’re going to be interacting with objects within it. If you’re a Windows person, you’ll be used to operating in terms of drive letters (C:\, A:\ etc…), with each drive containing directories and subdirectories in which you can keep your files. Mac OS X is built on BSD, but the user-facing file structure is abstracted from Unix, which lies beneath.

It’s not important to be an expert on the whole file structure to start moving, creating and deleting files, but it is important to at least have an overview.

At the top of the file hierarchy is ‘/’ or ‘root’. The immediate contents of ‘/’ varies from version to version, but there are several folders which are common to Unix systems.

  • var
  • tmp
  • usr
  • dev
  • etc
  • bin

Some of these are simply folders, containing system and user files and configuration information. ‘tmp’, for example, is the temporary folder, which any application can read and write to. ‘dev’, on the other hand, does not contain files or folders but is a listing of ‘essential devices’. A hard disk and its partitions will appear in the ‘dev’ folder, for example. This Wikipedia article details these folders and their functions in more detail, although it only applies to Linux systems.

A typical Mac OS X root listing

In addition to these system folders, there will be a folder containing individual users’ files. Under Linux, this folder is normally called ‘home’, whereas Mac OS X lists it as ‘Users’. The home folder contains directories for each registered user of the computer, within which users are freely permitted to go about their business.

A typical Linux root listing

The next part of the guide covers some basic file system navigation commands.

For a full list of topics covered in this tutorial series, head over to the index page.

One Response to “Linux Command Line Basics Part I: the Unix File Structure”

Leave a Reply