Unit 3 - Running Commands and Getting Help
From Msamir projects
Most of modern operating systems today have graphical user interface (GUI) which make user feel more comfortable with exploring thy files and surfing the web, but back in old days when computing resources was more valuable then user comfort OS was use command-line interface (CLI) CLI have some advantage over GUI like it's use much less computing resources (RAM/CPU ...) also CLI enables a user to easily script a sequence of commands to perform a task or execute a program.
Linux have many GUI desktop environments and you free to select what you like KDE, GNOME, Xfce, OpenWinodws but in any case you have to be familiar with CLI because sooner or later you will find that you have to run some commands in you shell.
A generic command following the same syntax which is.
% <command> [<options>] [<arguments>]
- A command line argument is an argument sent to a program being called "the command" . In general, a program can take any number of command line arguments, which may be necessary for the program to run, or may even be ignored, depending on the function of that program.
- A command line option or simply option (also known as a command line parameter, flag, or a switch) is an indication by a user that a computer program should change the command's behavior
Example:
msamir@fedora:~$ cd /home/redhat msamir@fedora:/home/redhat$
rhce@redhat:~$ cal
August 2009
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
rhce@redhat:~$ date Wed Aug 19 16:03:21 EEST 2009 rhce@redhat:~$ date -R Wed, 19 Aug 2009 16:03:22 +0300 rhce@redhat:~$ date -u Wed Aug 19 13:03:26 UTC 2009
Linux have really many commands and you don't have to memorize all this commands but you have to learn how to find what you need when you need it. there is many help resources in linux system and this section will give you overview how to talk through all this resources.
- if you know the command name but you don't know what command do and what switches can be used with this command you can try
<command name> --help
example
rhce@labserver:~$ mkdir --help
Usage: mkdir [OPTION] DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options too.
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
-p, --parents no error if existing, make parent directories as needed
-v, --verbose print a message for each created directory
-Z, --context=CTX set the SELinux security context of each created
directory to CTX
--help display this help and exit
--version output version information and exit
Report bugs to <bug-coreutils@gnu.org>.
- Whatis is a funny command that's bound to come in handy, especially while you're learning Linux. By typing "whatis" followed by a command, Linux returns the first line of the Man-page (manual page) for that command. Here's an example to show you what the "cp" command does
rhce@RHEL:~$ whatis ls ls (1) - list directory contents rhce@RHEL:~$ whatis mv mv (1) - move (rename) files rhce@RHEL:~$ whatis mkdir mkdir (1) - make directories
- Imagine you know only a part of the name or description of a command. Say for example, you remember "time," but not the whole of the command. Type:
Debian:~# apropos time bootparam (7) - Introduction to boot time parameters of the Linux kernel chrt (1) - manipulate real-time attributes of a process date (1) - print or set the system date and time exinext (8) - Finding individual retry times gstreamer-properties (1) - Multimedia systems selector install-keymap (8) - expand a given keymap and install it as boot-time keymap kbdrate (8) - reset the keyboard repeat rate and delay time ldconfig (8) - configure dynamic linker run-time bindings modules (5) - kernel modules to load at boot time mysql_tzinfo_to_sql (1) - load the time zone tables otp (1) - generate one-time key pads or password lists pam_time (8) - PAM module for time control access rtc (4) - real-time clock rtcwake (8) - enter a system sleep state until specified wakeup time s_time (1ssl) - SSL/TLS performance timing program slabtop (1) - display kernel slab cache information in real time sleep (1) - delay for a specified amount of time sysctl (8) - configure kernel parameters at runtime time (1) - run programs and summarize system resource usage time (7) - overview of time and timers time-admin (1) - Time Administration Tool time.conf (5) - configuration file for the pam_time module Tk::after (3pm) - Execute a command after a time delay touch (1) - change file timestamps tzfile (5) - time zone information tzselect (1) - view timezones tzselect (8) - select a time zone uptime (1) - Tell how long the system has been running. vcstime (8) - Show time in upper right hand corner of the console screen webspy (8) - display sniffed URLs in Netscape in real-time zdump (1) - time zone dumper zic (8) - time zone compiler
- Almost every command has a manual page and you can read this manual by use command man followed by command name
RedHat:~# man date
- While viewing a man page
- Navigate with arrows, pgUp, pgDown
- /<text> Search for text
- n/N Next/Previous match
- q Quit viewing page
- Searching the Manual
- man -k <keyword> List all matching pages
- Uses whatis database
debian:~# man -k what exiwhat (8) - Finding out what Exim processes are doing sudoers (5) - list of which users may execute what Tk::804delta (3pm) - what is new for perl/Tk 804 Tk::Internals (3pm) - what is Perl Tk interface doing when you call Tk functions. w (1) - Show who is logged on and what they are doing. w.procps (1) - Show who is logged on and what they are doing. whatis (1) - display manual page descriptions
- Each software you install in your machine there is very hight probability that i will include extended documentation in /usr/share/doc directory
- There is many resource online
| « | RedHat Linux Essentials Running Commands and Getting Help | » |
| Linux Usage Basics | Browsing the Filesystem |
