الخميس، 11 يونيو، 2009

quick start with commands

Understanding the Command Line
Hang around Linux users for any length of time and it
won’t be long before you hear them speak in hushed tones
about the command line or the terminal. Quite rightly, too,
because the command line offers a unique and powerful
way to interact with Linux. However, for the most part,
you may never need to access the command line because
Fedora offers a variety of graphical tools that enable you to configure most things on your system.

Navigating Through the File System
Use the cd command to navigate through the Fedora file system. This command is gener-
ally used with a specific directory location or pathname, like this:
$ cd /usr/share/doc
Under Fedora, the cd command can also be used with several shortcuts. For example, to
quickly move up to the parent (higher-level) directory, use the cd command like this:
$ cd ..
To return to one’s home directory from anywhere in the Linux file system, use the cd
command like this:
$ cd
You can also use the $HOME shell environment variable to accomplish the same thing.
Type this command and press Enter to return to your home directory:
$ cd $HOME
You can accomplish the same thing by using the tilde (~) like this:
$ cd ~


Another important command to use is the ls command, which lists the contents of the
current directory. It’s commonly used by itself, but a number of options (or switches)
available for ls give you more information. For instance, the following command returns
a listing of all the files and directories within the current directory, including any hidden
files (denoted by a . prefix) as well as a full listing, so it will include details such as the
permissions, owner and group, size, and last modified time and date:
$ ls -al
You can also issue the following command:
$ ls -R
This command scans and lists all the contents of the subdirectories of the current direc-
tory. This might be a lot of information, so you might want to redirect the output to a
text file so that you can browse through it at your leisure by using the following:
$ ls alR > listing.txt


Basic Linux Directories

Name 
/
/bin
/boot
/dev
/etc
/home
/initrd
/lib
/lost+found
/media
/mnt
/opt
/proc
/root
/sbin
/selinux
/sys
/tmp
/usr
/var       
Managing Files with the Shell

. cat filename—Outputs contents of filename to display
. less filename—Allows scrolling while reading contents of filename
. mv file1 file2—Renames file1 to file2
. mv file dir—Moves file to specified directory
. cp file1 file2—Copies file1 and creates file2
. rm file—Deletes file
. rmdir dir—Deletes directory (if empty)
. grep string file(s)—Searches through files(s) and displays lines containing
matching string

ليست هناك تعليقات:

إرسال تعليق