Linux Server Configuration


Creating Directory: mkdir


Download 493.5 Kb.
bet5/48
Sana16.06.2023
Hajmi493.5 Kb.
#1495871
1   2   3   4   5   6   7   8   9   ...   48
Bog'liq
0501-linux-server-configuration

1.3.3 Creating Directory: mkdir


The mkdir command makes new directory under an existing directory. For example to create a directory for storing music files:


$ mkdir musics


To delete an empty directory we use rmdir command.


$ rmdir OldMusics


We use rm with –r option to delete directories and all the files (recursively) they contain.


$ rm -r OldMusics




1.3.4 Viewing Hidden Files And Directories: ls -a


The special . and .. directories don’t show up when we do ls. They are hidden files


Files whose name starts with a dot ( . ) are considered hidden.

Make ls to list all files, even the hidden ones, by giving the –a option:


$ ls -a


. .. .bashrc .profile report.doc

1.4 Working With Files


This section describes utilities that copy, move, print, search through, display, sort, and compare files.




1.4.1 Display A Text File: cat


The cat utility displays the contents of a text file. The name of the command is derived from catenate, which means to join together, one after the other. A convenient way to display the contents of a file to the screen is by giving the command cat, followed by a SPACE and the filename. Figure 1.5.1 shows cat displaying the contents of practice. This figure shows the difference between the ls and cat utilities: The ls utility displays the name of a file, whereas cat displays the contents of a file.


1.4.2 Delete A File: rm


The rm (remove) utility deletes a file. Figure 1 shows rm deleting the file named practice. After rm deletes the file, ls and cat show that practice is no longer in the directory. The ls utility does not list its filename, and cat says that no such file exists.


Use rm carefully.
$ ls
practice
$ cat practice
This is a small file that I created
with a text editor.
$ rm practice
$ ls
$ cat practice
cat: practice: No such file or directory
$



Download 493.5 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   48




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