Linux /Unix File System Basic Commands

RHCE Linux Commands : Login in to Linux Terminal

Virtual Consoles:

A virtual console is a command line where you can log into and control Linux. As RHEL is a multi-terminal operating system, you can log into Linux, ever with the same user ID, several times. It’s easy to open a new virtual console. Just use the appropriate ALT-function key combination. E.g. pressing ALT+F2 brings you to second virtual console. You can switch between adjacent virtual console by pressing ALT+Right ARROW or ALT+Left ARROW. E.g. to move from virtual console 2 to virtual console 3, press ALT+Right ARROW.

You can switch between virtual terminals by just press the

ALT+CTRL+Function key combinations.

ALT + CTRL + F1 for terminal 1

ALT + CTRL + F2 for terminal 2

ALT + CTRL + F3 for terminal 3

ALT + CTRL + F4 for terminal 4

ALT + CTRL + F5 for terminal 5

ALT + CTRL + F6 for terminal 6

ALT + CTRL + F7 for terminal 7

Terminal 7 is by default graphic mode beside it all six terminals are CLI (Command Line Interface) base. Open any terminal using press ALT+CTRL+F1 key combination. Root account is automatically created when we install Linux.

Type root on login name and press enter key, now give password (no asterisk character like windows to guess the password length) When you login from root account you will get # sign at command prompt, and when you login from normal user you will get $ sign prompt.

#clear

This command is used for clearing the screen.

You have 3 options to logout

Press CTRL+D

#exit

#logout

All three commands perform same task

#pwd

/root PWD (Print Working Directory) command will tell you about current location from/ partition.

#ls

ls command List the object in directory. All directories are listed in blue color while files are shown white color.

#ls -a

Normal ls command will not list the hidden file use -a switch with ls command to list the hidden files.

#ls -l

ls command with -l switch will list the object in long formats.

#ll

Same as ls -l. first and major task for any system administrator is use managements, for testing purpose you can perform all task with root account but in real life root account is used for administrative purpose only. Let’s create a normal user account for further practice.

#useradd [ user name ]

useradd command is used to create user. Several advance options are used with useradd command, but you will learn about soon.

#passwd [ user name ]

in Linux no user can be login without password. “passwd” command is used to assign password for any user. Do not execute this command without username other wise it will changes root password. Some basic commands which are required to perform day to day task by user. In our last assignment we created a normal user name thinker. Now login from thinker, and try to find out what are the difference you noticed when you login from normal user.

In bracket right most side is showing user name thinker and beside @ localhost is the hostname of computer and further ~ sign is showing that user is presently logged in her home directory. But first, every Linux user has a home directory. You can use the tiled “~” to represent the home directory of any currently active user.

For Example, if your user name is thinker, your home directory is home/thinker.

If you have logged in as the root user, your home directory is /root.

Thus, the effect of the cd ~ command depend on your username.

For Example, if you have logged In as user prafulla, the cd command bring you to the

/home/prafulla directory. if you have logged In as root user this command bring you to the /root directory. You can list the contents of your home directory from anywhere in the directory tree with the ls ~ command. After bracket you can see the command prompt of normal user is $ sign.

 

-P. M. Sagavekar

Linux /Unix File Systems and Directories Command Line

Type of files used by Linux :

When working with Linux, you need to be aware of the fact that there are a number of different file types used by the file system. This is another area where the Linux file differ significantly from the widows file system. With a windows file system you basically have two different types in the file system.

Directories
Files

 

You can have normal file, hidden file, shortcut file, word processing file, executable file, etc.

However, these are a variety of different file type used by the system.

File type as shown below:

 

File Type

Description

Regular Files These files are like those used by the file systems of other operating system – e.g. Open Office.org files, executable files, images, text configuration files, etc.
Links These files are pointers that point to other files in the file system.
FIFOs FIFO stands for (First In First Out) these are special files used to move data from one running process on the system to another. A FIFO file is basically a queue where the first chunk of data added to the queue is the first chunk of the data removed from the queue. Data can only move in one direction through a FIFO.
Sockets Sockets are similar to FIFOs in that they are used to transfer information between sockets. With a socket, however, data can move bi-directionally.

Linux /Unix File Systems and Directories

Several major directories are associated with all modern Unix/Linux operating systems. These directories organize user files, drivers, kernels, logs, programs, utilities, and more into different categories. The standardization of the FHS makes it easier for user of other Unix-based operating systems to understand the basics of Linux. Every FHS start with the root directories, also known by its label, the single forward slash “/”. All the other directories shown in table are subdirectories of the root directory. Unless they are mounted separately, you can also find their files on the same partition as the root directory.

Command

Command Description

/ The root directory, the top level directory in the FHS. All other directories are sub directories of root, which is always mounted on same partition. All directories that are not mounted on a separate partition are include in the root directories partition.
/bin Essential command line utilities. Should not be mounted separately; otherwise, it could be difficult to get to these utilities when using a rescue disk.
/boot Includes Linux start up files, including the Linux Kernel. Can be small; 17MB usually adequate for a typical modular kernel. If you use multiple kernels, such as for testing a kernel upgrade, increase the size of this partition accordingly.
/etc Most basic configuration files.
/dev Hardware and software device drivers for everything from floppy drives to terminals. Do not mount this directory on separate partition.
/home Home directories are almost every user.
/lib Program library for the kernel and various command line utilities. Do not mount this directory on separate partition.
/mnt The mount point for the removable media including floppy drives, CD -ROM’s and zip disks.
/opt Application such as Wordperfect or Star Office.
/proc Currently running kernel-related process, including device assignment such as IRQ ports, I/O addresses, and DMA channels.
/root The home directory of the root user.
/sbin System administrator commands. Don’t mount this directory separately.
/tmp Temporary files. By default, Red Hat Linux deletes all files in this directory periodically.
/usr Small programs accessible to all user. Includes many system administrator commands and utilities.
/var Variable data, including log files and printer spools.

 

Some of the configuration files in  /etc directory that you should remember:

 

File

Function

/etc /fstab Lists the partition and file systems that will be automatically mounted when the system boots.
/etc /group Contains local group definitions.
/etc /grup.cong Contains configuration parameters for the GRUP boot loader (assuming its being used on the system).
/etc /hosts Contains a list of hostname-to-IP address mapping the system can use to resolve hostnames.
/etc /inittab Contains configuration parameter for the init process.
/etc /init.d/ A subdirectory that contains starup script for services install on the system. On Fedora or Red Hat system, these are located in /etc /rc.d /init.d.
/etc /modules.conf Contains configuration parameters for your kernel modules.
/etc /passwd Contains your system user account.
/etc /shadow Contains encrypted passwords for your user accounts.
/etc /X11/ Contains configuration files for X windows.

 

In this assignment I will instruct you about some basic commands of Linux. You will get seven virtual terminals when you perform fill installations. Although you can use graphics for daily task but here we are preparing for RHCE exam so you must use command line interface. Because all questions are based on command line in RHCE Exam.

 

-P. M. Sagavekar

RHCE (Red Hat Linux Certified Engineer) Skills

RHCE (Red Hat Linux Certified Engineer) SKILLS :

Troubleshooting and System Maintenance

RHCE must demonstrate the RHCE skills listed above, and should be able to:

  • Use the rescue environment provided by first installation CD
  • Diagnose and correct boot failure arising from boot, module, and file system errors
  • Diagnose and correct problems with network service (see installation and configuration below for a list of these services)
  • Add, remove, and resize logical volumes
  • Diagnose and correct networking services problem where SELinux contexts are interfering with proper operation.

 Installation And Configuration

RHSE must demonstrate the RHCT-level skills listed above, and they must be capable of configuring the following network services:

  • HTTP/HTTPS
  • SMB
  • NFS
  • FTP
  • WEB Proxy
  • SMTP
  • IMAP, IMAPS, and POP3
  • SSH
  • DNS(catching name server, slave name server)
  • NTP

For each of these services, RHCE must be able to:

  • Install the package needed to provide the service
  • Configure SE Linux to support the service
  • Configure the service to start when the system is booted
  • Configure the service for basic operation
  • Configure host-based and usre-based security for the service
  • RHCE must also be able to:
  • Configure hands-free installation using kick start
  • Implement logical volumes at install-time
  • Use Ip tables to implement packet filtering and/or NAT
  • Use PAM to implement user-level restrictions

Based on this RHCE guide we have created step by step guide of RHCE exam, By our RHCE guide you can get your RHCE certificates. We have managed various practical examples and suggest you to go through all these.

Everything in Linux can be reduced to a file, partitions are associated with files such as/ dev/hda1. Hardware components are associated with file such as / dev/modem. Detected device are documented as files in the /proc directory. The File system Hierarchy standard (FHS) is the official way to organize files in Unix and Linux directories.

 

-P. M. Sagavekar

RHCT (Red Hat Linux Certification Training) Skills

RHCT (Red Hat Linux Certification Training) Skills

 Troubleshooting and System Maintenance

RHCTs should be able to:
  • Boot systems into different run levels for troubleshooting and system maintenance
  • Diagnose and correct misconfigured networking
  • Diagnose and correct hostname resolution problems
  • Configure the X Window System and a desktop environment
  • Add new partitions, file systems, and swap to existing systems
  • Use standard command-line tools to analyses problems and configure system

Installation And Configuration:

  • RHCT must be able to:
  • Perform network OS installation
  • Implement a custom partitioning scheme
  • Configure printing
  • Configure the scheduling of task using cron and at
  • Attach system to a network directory service, such as NIS or LDAP
  • Configure autofs
  • Add and manage users, groups, quotas, and file Access Control Lists
  • Configure file system permissions for collaboration
  • Install and update package using rpm
  • Properly update the kernel package
  • Configure the system to update/install package from remote repositories using yum or pup
  • Modify the system boot loader
  • Implement software RAID at install-time and run-time
  • Use /proc/sys and sysctl to modify and set kernel run-time parameters
  • Use scripting to automate system maintenance tasks

Configure NTP for time synchronization with a higher-stratum server.

 

-P. M. Sagavekar