| 29 Changing Owner and Group




Download 4,86 Mb.
Pdf ko'rish
bet16/18
Sana23.12.2023
Hajmi4,86 Mb.
#127288
1   ...   10   11   12   13   14   15   16   17   18
Bog'liq
introductiontolinux

29
Changing Owner and Group
WARNING - DO NOT ATTEMPT THIS!
– If you change the permissions of your own files you will 
not be able to recover them!
In order to change the owner and group of a file, the commands ‘chown’ and ‘chgrp’ are used. To 
change the owner and group simultaneously, one can simply issue the ‘chown’ command, specifying 
a group after the username separated by a colon ( : ) .
If we attempt to change the ownership of a file to something other than ourselves, then we could 
potentially lose the ability to manage it (delete, move, rename, etc). 
Changing permissions on files can be problematic if you do not have super-user (admin / root) 
access to the system you are working on, and will generally result in a rather annoyed Systems 
Administrator having to fix permissions on the changed files.


30
 |
Editing Files
Nano (formerly pico)
‘echo ’ is a very useful command if we want to add text to a file, however it cannot be used to modify 
an existing file. For this, we have to use a text editor. The two standard text editors in Linux are 
‘vim’ and ‘pico ’ (now known as ‘nano’). ‘vim ’ (also known as ‘vi’ (vee-eye)) is a rather hardcore text 
editor, which is remarkably non-user-friendly. It is the preferred text editor by the highly experienced 
of console users; however it is very complicated to learn. Feel free to read up on ‘vim’ in your own 
time by looking at its ‘man’ page and looking online for help. For today, we will learn to use ‘pico ’ 
to modify the contents of a file.
Pico is very much like ‘Notepad’ but without a mouse. All commands are executed through the use 
of the keyboard, using the  key modifier. It can be used to edit virtually any kind of text file 
from the command line, and is frequently used to configure services after they have been installed.
This is a standard (blank) Pico window, as you will see if you run the command ‘pico ’ from the 
command prompt. At the bottom of the screen, there are commands with a ‘^’ symbol in front. 
These are the commands that can be used. The ‘^’ shows that you need to hold down the Control 
(Ctrl) key, and then press the corresponding letter of the command you wish to use. For Example: 
Ctrl+X will exit Pico and return you to the Command Line.



Download 4,86 Mb.
1   ...   10   11   12   13   14   15   16   17   18




Download 4,86 Mb.
Pdf ko'rish