August 12, 2010

Login Linux Terminal

Login linux terminal pwd ls useradd commands accessing virtual terminals

In this assignment I will instruct you about some basic commands of Linux. You will get seven virtual terminal when you perform full 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 question are based on command line in RHCE Exam.

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, even with the same user ID, several times. It's easy to open a new virtual console. Just use the appropriate ALT-function key combination. For example, pressing ALT-F2 brings you to the second virtual console. You can switch between adjacent virtual consoles by pressing ALT-RIGHT ARROW or ALT-LEFT ARROW. For example, 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+Funcation 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 terminal are CLI based. Open any terminial by press ALT+CTRL+F1 key combinations. root account is automatically created when we install Linux.

default login screen

Type root on login name and press enter key, now give password ( no asterisk character like window 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 $ prompt.

login in linux

#clear

This command is used to clear the screen.You have three options to logout .


Press CTRL+D
#exit
#logout

All three commands perform same task.


#pwd
/root

linux basic command

Print working directory command will tell you about current location from / partition.


#ls

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


#ls –a

Normal ls command will not list the hidden files. If you want to 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 objects in long formats . we will discuss more about –l switch in coming sections.


#ll

Same as ls –l . First and major task for any system administrator is user managements. For testing purpose you can perform all task with root account but in real life root account is used for administrative purpose only. Lest create a normal user account for further practical.


#useradd [user name ]

Useradd command is used to create user. Several advance options are used with useradd command but you will learn about them in coming article.

linux create user


#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 user name otherwise it will change root password.

Linux Unix Filesystem Hierarchy and Structure

Overview of the FHS

Everything in Linux can be reduced to a file. Partitions are associated with files such as /dev/hda1. Hardware components are associated with files such as /dev/modem. Detected devices are documented as files in the /proc directory. The Filesystem Hierarchy Standard (FHS) is the official way to organize files in Unix and Linux directories.

Linux/Unix Filesystems 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 users of other Unix-based operating systems to understand the basics of Linux. Every FHS starts with the root directory, also known by its label, the single forward slash (/). All of 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.

/ The root directory, the top-level directory in the FHS. All other directories are subdirectories of root, which is always mounted on some partition. All directories that are not mounted on a separate partition are included in the root directory?s 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 startup files, including the Linux kernel. Can be small; 16MB is 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 a separate partition.
/home Home directories for almost every user.
/lib Program libraries for the kernel and various command line utilities. Do not mount this directory on a separate partition.
/mnt The mount point for removable media, including floppy drives, CD-ROMs, and Zip disks.
/opt Applications such as WordPerfect or StarOffice.
/proc Currently running kernel-related processes, including device assignments such as IRQ ports, I/O addresses, and DMA channels.
/root The home directory of the root user.
/sbin System administration 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 users. Includes many system administration commands and utilities.
/var Variable data, including log files and printer spools.

Types 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 system differs significantly from the Windows file system. With a Windows file system you basically have two entry types in the file system:

  • Directories
  • Files

Granted, you can have normal files, hidden files, shortcut files, word processing files, executable files, and so on. However, these are all simple variations of the basic file when working with Windows.
With Linux, however, there are a variety of different file types used by the file system. These include the file types shown in Table

File Type Description
Regular files These files are similar to those used by the file systems of other operating systems—for example, executable files, OpenOffice.org 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 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.

Some of the Configuration Files in /etc Directory that you should remember

File Function
/etc/fstab Lists the partitions and file systems that will be automatically mounted when the system boots.
/etc/group Contains local group definitions.
/etc/grub.conf Contains configuration parameters for the GRUB bootloader (assuming it’s being used on the system).
/etc/hosts Contains a list of hostname-to-IP address mappings the system can use to resolve hostnames.
/etc/inittab Contains configuration parameters for the init process.
/etc/init.d/ A subdirectory that contains startup scripts for services installed on the system. On a 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 accounts.
/etc/shadow Contains encrypted passwords for your user accounts.
/etc/X11/ Contains configuration files for X Windows.

RHCE and RHCT Exam Preparation Guide


Study Points for the RHCE Exam

  • use standard command line tools (e.g., ls, cp, mv, rm, tail, cat, etc.) to create, remove, view, and investigate files and directories
  • use grep, sed, and awk to process text streams and files
  • use a terminal-based text editor, such as vim or nano, to modify text files
  • use input/output redirection
  • understand basic principles of TCP/IP networking, including IP addresses, netmasks, and gateways for IPv4 and IPv6
  • use su to switch user accounts
  • use passwd to set passwords
  • use tar, gzip, and bzip2
  • configure an email client on Red Hat Enterprise Linux
  • use text and/or graphical browser to access HTTP/HTTPS URLs
  • use lftp to access FTP URLs

RHCT 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, filesystems, and swap to existing systems
  • use standard command-line tools to analyze problems and configure system

Installation and Configuration

RHCTs must be able to:

  • perform network OS installation
  • implement a custom partitioning scheme
  • configure printing
  • configure the scheduling of tasks 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 filesystem permissions for collaboration
  • install and update packages using rpm
  • properly update the kernel package
  • configure the system to update/install packages from remote repositories using yum or pup
  • modify the system bootloader
  • 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

RHCE skills

Troubleshooting and System Maintenance

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

  • use the rescue environment provided by first installation CD
  • diagnose and correct boot failures arising from bootloader, module, and filesystem errors
  • diagnose and correct problems with network services (see Installation and Configuration below for a list of these services)
  • add, remove, and resize logical volumes
  • diagnose and correct networking services problems where SELinux contexts are interfering with proper operation.

Installation and Configuration

RHCEs 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 (caching name server, slave name server)
  • NTP

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

  • install the packages needed to provide the service
  • configure SELinux to support the service
  • configure the service to start when the system is booted
  • configure the service for basic operation
  • Configure host-based and user-based security for the service

RHCEs must also be able to:

  • configure hands-free installation using Kickstart
  • implement logical volumes at install-time
  • use iptables 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 example and suggest you to go through all these.