Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet30/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   26   27   28   29   30   31   32   33   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

Command
Description
Common Options
pwd
Display current directory
cd
Change directory
ls
List contents of directory
-a (all), -l (long listing), -r (reverse), -R 
(recursive), -S (sort by file size), -1 (display in 
one column)
mv
Move or rename file(s)/directory(ies)
-f (force), -i (interactive), -n (do not overwrite 
existing file)
cp
Copy file(s)
same as mv, also -r (recursive)
rm
Delete file(s)
-f (force), -i (interactive), -r (recursive)
mkdir
Create a directory
rmdir
Delete a directory
cat
Concatenate files (display to window)
-n (add line numbers), -T (show tabs)
less
Display file screen-by-screen
-c (clear screen first), -f (open nonregular files)
more
Display file screen-by-screen
-num # (specify screen size in # rows), 
+

(start at row number #)
find
Locate file(s)
Covered in Table 3.6


Navigating the Linux File System

81
$ pwd
/home/foxr
$
Of course, you can also identify the current working directory by examining your user 
prompt. Unless you have changed it, it should contain the working directory, for instance:
[foxr@localhost ~] $
Unfortunately, the prompt only displays the current directory’s name, not its full path. 
If you were in a subdirectory of foxr’s called TEMP, the prompt would look like this:
[foxr@localhost TEMP] $
To navigate around the file system, you need to change the directory. The command to 
do that is 
cd
. The command expects the path to the destination directory. This path can be 
relative or absolute. You would only specify a directory, not a filename, in the command. 
Referring back to Figure 3.3, and assuming you are currently in /home/zappaf, the follow-
ing cd commands can be used to navigate about this file space.
• To reach /bin either cd /bin or cd ../../bin
• To reach marst either cd /home/marst or cd ../marst
• To reach temp either cd /home/foxr/temp or cd ../foxr/temp
• To reach a either cd /home/foxr/temp2/a or cd ../foxr/temp2/a
If you were in b, you would issue these commands.
• To reach a either /home/foxr/temp2/a or ../a
• To reach temp either /home/foxr/temp or ../../temp
• To reach dukeg either /home/dukeg or ../../../dukeg
If you have a lot of different directories that you wish to visit often, you might place them 
onto the directory stack. The 
dirs
command displays all directories on the stack. To add 
a directory, use 
pushd 
dirname
. The push operation places the new directory on the 
“top” of the stack, so you are actually building your list backward. To remove the top direc-
tory from the stack, use 
popd
.
Once we have moved to a new location in the file system, we may want to view the con-
tents of the current location. This is accomplished through the ls command. As we already 
explored the ls command in some detail in Chapter 2, we will skip it here.
3.3.2 File Movement and Copy Commands
Now that we can navigate the file system and see what is there, we want to be able to 
manipulate the file system. We will do this by moving, renaming, copying, deleting files 


82

Linux with Operating System Concepts
and directories, and creating files. The commands 
mv

cp
, and 
rm
(move/rename, copy, 
delete) can work on both files and directories. For each of these, however, the user issu-
ing the command must have proper permissions. We will assume that the commands are 
being issued on items whose permissions will not raise errors.
The mv (move) command is used to both move and rename files/directories. The stan-
dard format for 
mv
is
mv [

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   26   27   28   29   30   31   32   33   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish