The course material explains some pretty basic stuff like cd, pwd, ls and the like. So I will probably not cover every subchapter.
The default shell is bash.
Other shells can easily installed with yum.
|bash||The default Bourne-Again shell.|
|dash||A simpler shell with fewer features than bash, but faster.|
|tcsh||An enhanced version of the Unix C shell.|
|zsh||A sophisticated shell, similar to the korn shell.|
The default shell of a specific user can be changed in /etc/passwd.
By default, six command line consoles are available on RHEL systems.
If a GUI is installed it takes /dev/tty1.
These settings, including the x tty can be changed in:
Active consoles are defined as device files /dev/tty1 through /dev/tty6.
Usually you can access the consoles with ALT-F1 - F6. However, on RHEL Systems with a GUI Alt-F2 is used to start the Run Application tool; therefore, you'll need to press CTRL-ALT-F2 to move to that second virtual console.
If a Desktop Environment like GNOME or KDE is installed you usually have some graphical terminals as well.
The upside of graphical environments are features like tabs, windows, copy and paste etc.
Linux uses three basic data streams. stdin, stdout and stderr. You can redirect these streams to or from a file.
# database < datafile
Standard input can come from the left side of a command as well. For example, if you need to srcoll through the boot messages, you can combine the dmesg and *less commands with a pipe:
# dmesg | less
The output from dmesg is redirected as standard input to less.
# ls > filelist
To append the output to a file use:
# ls >> filelist # # Or to be sure: # ls >\> filelist
# program 2> err-list
(~) skull@dc:$ echo $PATH /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/data/skull/bin:/data/skull/scripts (~) root@dc:# echo $PATH /usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
ln creates a link in the file system. There are two kinds of links: soft links and hard links.
To create a hard link:
# ln /etc/samba/smb.conf ~/smb.conf
To create a soft link:
# ln -s /etc/samba/smb.conf ~/.smb.conf
# find / -name named.conf
This search can take some time, because the parameter '/' tells find to start search in the root directory.
To specify another directory just use:
# find /usr -name named.conf
If you don't know the name of the file you can use wildards.
|*||Any. That means any alphanumeric character.|
|?||One. One single alphanumeric character.|
|||Range. A Range of options. For example, the ls ab command would return the following filenames: ab1, ab2, ab3.|
For a faster file search you should use locate. It is installed on common RHEL System. If not:
# yum install mlocate
# locate filename.txt
Locate uses a database which gets updated once a day. To update the database manually use:
Most files in Linux are text files. To actually look up the filetype use the file command.
(~) root@dc:# file /etc/samba/smb.conf /etc/samba/smb.conf: UTF-8 Unicode English text
Prints the whole file.
less and more display the content of a file on the screen and separates it into pages.
|space||One page forward.|
|pgup and pgdown||Navigate through the pages.|
|/something||Searches for 'something'. Navigate through the results with n and N like in vi.|
One of the advantages of less over more is that less can actually read compressed files in .tar.gz archives.