Linux Server Configuration


Changes The Name Of A File : mv


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

1.4.5 Changes The Name Of A File : mv


The mv (move) utility can rename a file without making a copy of it. The mv command line specifies an existing file and a new filename using the same syntax as cp:




mv existing-filename new-filename

The command line in Figure 1.6.2 changes the name of the file memo to memo.0130.


The initial ls command shows that memo is the only file in the directory. After you give the mv command, memo.0130 is the only file in the directory. Compare this result to that of the earlier cp example.

$ ls


memo
$ mv memo memo.0130
$ ls
memo.0130


1.4.6 Search For A String In A File: grep


The grep utility searches through one or more files to see whether any contain a specified string of characters. This utility does not change the file it searches but simply displays each line that contains the string.


$ cat memo


Helen:
In our meeting on June 6 we
discussed the issue of credit.
Have you had any further thoughts
about it?
Alex
$ grep 'credit' memo
discussed the issue of credit.

The grep command in Figure 1.6.3 searches through the file memo for lines that contain the string credit and displays a single line that meets this criterion. If memo contained such words as discredit, creditor, or accreditation, grep would have displayed those lines as well because they contain the string it was searching for. The –w option causes grep to match only whole words. Although you do not need to enclose the string you are searching for in single quotation marks, doing so allows you to put SPACEs and special characters in the search string.


1.5 Process Management


The kernel considers each program running on our system to be a process. A process ‘lives’ as it executes with a lifetime that may be short or long. A process is said to die when it terminates. The kernel identifies each process by a number known as process id, or pid. A process has a user id(uid) and a group id(gid) which together specifies what permissions it has. A process has a parent process id (ppid) – the pid of the process that has created it.


Each process has its own working directory initially inherited from its parent process. There is an environment for each process. A collection of named environment variables and their associated values. The environment is usually inherited from the parent process.





Download 493.5 Kb.

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




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