FANDOM


(stubbed out) This will host various explanations of Linux basics. As that is actually a pretty broad category, this page will likely have to be split up in the future.

Linux is picky!Edit

Some people coming to Linux from Windows can be perplexed by the fact that Linux is case sensitive - that is, Linux (capital L) is not the same as linux (lowercase l). Keep this in mind when working from terminals. Similarly, as spaces are used in Linux terminals to separate commands from their arguments and switches, spaces (and other special characters) in file names must be treated specially. To explain, take a simple example. Perhaps you have a file named John Smith.rtf with a space in the file name. Say you wanted to remove this file. The following would not remove the file:

$ rm John Smith.rtf

Spaces are not treated specially by Linux. In this example, the remove (rm) command is being sent two separate arguments; that command would attempt to remove two files - one named John and one named Smith.rtf.

This does not mean that Linux is totally vexed by spaces in file names! There are three methods to deal with spaces and other special characters in Linux: escaping and quotation marks. To remove John Smith.rtf, we would do either of the following commands:

$ rm "John Smith.rtf"
$ rm John\ Smith.rtf
$ rm 'John Smith.rtf'
 

Here, the \ (a backslash or "whack") tells the remove command (rm) to treat the character immediately after the \ (here, the space) as part of the file name. Similarly, enclosing the file name in quotes will accomplish the same as escaping special characters.

"Extensions"Edit

File extensions do not mean anything to a Linux system itself. In general, file extensions - a .foobar ending to a file - are included only for human reference. For example, in Linux systems, config files are often appended with .conf, documents might be appended with .odt, .rtf, .doc, image files might be .jpg, .tiff, .gif, and so on. The important thing to keep in mind is that the period is not treated specially by Linux but is instead considered to be a part of the file name. In Windows operating systems, the . is considered a "divider" between the file name and the extension. So, in Windows, for the file John Smith.rtf, "John Smith" is the file name, and ".rtf" is the file extension. Linux and Unix-like systems treat the entire "John Smith.rtf" as the file name.

What is a terminal?Edit

Instructions for Linux often include parts about "opening up a terminal" or "command line." Essentially, in general, when somebody says "terminal," what's meant is either a terminal emulator or "virtual terminal"(tty). In simple terms, a terminal emulator is a program that puts a usable command-line shell into an X window - it allows you to have a fully functional command line within a GUI session. A virtual terminal is a command-line only screen - most Linux systems have 7 "TTYs" - 1-6 are used for text only shells, and 7 is usually considered reserved for an X11 (GUI) session. In order to switch between TTYs, use the "Ctrl-Alt-Fx" combination - to move to tty1, press Ctrl-Alt-F1; to move to tty, Ctrl-Alt-F2; to move back to tty7 (X session), Ctrl-Alt-F7.

As a rule, a TTY is functionally equivalent to a terminal emulator; however, terminal emulators, being run in a window from a GUI environment, often support handy features such as multiple tabs, coloring and theming, transparency and other eye-candy, and the ability to copy. Fedora uses GNOME by default, and GNOME's built-in terminal emulator is gnome-terminal. Other fully-fledged terminals exist for various GUI environments.

Tab completionEdit

Tab completion is the use of the TAB key to save typing at the command line. Bash and some other Linux-compatible text shells support tab completion. With tab completion, the terminal operator types the first few letters of a file name or command and then hits tab to have the terminal auto-complete the rest of the file name or command. If multiple possibilities exist, the shell will display those possibilities. As an example, consider that you have a file named "Financial Report for 10-23-2013.xls" in the present working directory. If one presses the tab key after entering the first few characters in an argument, the shell will complete it for you but will not execute the command. For example, to remove that file with a few keystrokes:

$ rm Fin <press tab>

The shell will expand the command to:

$ rm Financial\ Report\ for\ 10-23-2013.xls <hit enter to execute>

Or, to auto-complete a command:

$ ama <press tab>
$ amarok

Basic terminal navigationEdit

Basic stuff here: enter to execute command, up key to recall previous command, Ctrl-C, Ctrl-D, Ctrl-L, Ctrl-W, etc. A table?

Basic Heirarchy on Unix-like systemsEdit

Many new users will be confused by the general heirarchy of directories on Unix-like machines. Though most distributions in some way deviate from the "filestem heirarchy," some general rules of thumb can be drawn:

/ - the root file system; all mounted devices on Linux machines reside under the / directory
/bin - executable files needed for single user mode
/boot - kernel images as well as configuration files read by second-stage boot loaders
/dev - device nodes (special files representing real hardware devices)
/etc configuration files
/home - user directories are located under /home in /home/username; users' personal files are typically stored in their personal home directories
/lib - shared libraries
/media - by convention, mount points for removable media
mnt - by convention, temporarily mounted file systems
/opt - add-on packages; /opt is sometimes used to house add-on software that system admins have manually installed
/proc - a quasi-file system used to hold information about running processes, the kernel, and hardware statistics
/root - pronounced as "slash-root"; the root user's home directory
/sbin - executable files needed to run the system, but mostly commands that don't need to be used by normal users
/tmp - temporary files
/usr - shared data, should be read-only for all users
/var - dynamic content, including log files, the kernel ring buffer (/var/log/messages), and, on web and ftp servers, usually housing content to be made available over those services

For more information, please see "man hier".

Linux Run levelsEdit

Run levels are used in most UNIX and Unix-Like systems. The run levels are different configurations of services and capabilities that are configurable. The run levels are managed by the init system. Using the init command, a user logged in as root or super user can set the current run level. For example, to switch to runlevel 3 from any other runlevel:

init 3

Though the superuser can manually change the run level, it is advisable to set up your machine to boot into the run level most appropriate to your needs. Setting the default run level is done by editing the /etc/inittab file. Under the heading of "System initialization" the following line can be found. The example below is set to run level 5 and indicated by the 5. This can be changed to any run level, but you should not set it to 1 or 6.

id:5:initdefault:

The run levels can vary widely from distribution to distribution. On Fedora, they are as follows:

0 - Halt

  • Shuts down and possibly turn off the power

1 - Single user mode

  • No Network or Network services
  • No authentication
  • Used for troubleshooting
  • Do not use as your inittdefault unless you really know what you're doing.

2 - Not used/User definable

3 - Full multi-user; no X startup

  • Console log-ins only
  • The typical run level for servers
  • GUI capable but not running by default

4 - Not used/User definable

5 - Full multi-user

  • GUI and console logins
  • GUI is running by default
  • Default for Fedora installations (see below) - best runlevel for Desktops and Workstations that will be running X routinely

6 - Restart

  • Do not use as your default runlevel unless you want your system to reboot as soon as the kernel starts init!

Note that the initdefault setting in /etc/inittab is configured by the Fedora installer at install time. Generally, the runlevel will be set to 5 by the installer. However, 3 will be set as the default runlevel in two situations:

  • If you do not install X
  • If you run the text-based installer: even if you install a full X setup using the text-based Anaconda installer, the default runlevel may be set to 3. If you use the text-based installer, you will probably be booted into Runlevel 3 until you change /etc/inittab.

More information can be found on Wikipedia or "Init Runlevels" at Redhat.com.

Unix permissionsEdit

Octal PermissionsEdit

The "Sticky Bit"Edit

Command not foundEdit

New users will often post questions similar to this: "I logged in as root but some commands that are installed on my system return "command not found" errors." This is an issue with the user's $PATH environment variable - a problem doesn't exist; bash is doing exactly as it should. Normal users, by default, do not have /sbin utilities in their path. What this means is that normal users, when executing /sbin utilities, must specify the full explicit path (such as /sbin/ifconfig), because bash has not been set up to look in the /sbin directory for utilities.

When you switch users to become root with the "su" command without arguments, your working path will not be changed. In order to get root's full path, you should log in as full root with root's path using "su -" (that is "su-space-hyphen"). Alternatively, you can add /sbin to the $PATH for your normal user(s). For more on environment variables and modifying your users' $PATHs, please see this excellent explanation.

Command-Line Text EditorsEdit

pico/nanoEdit

viEdit

adbsjklaldkff

See alsoEdit

Basic Linux Commands

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.