Previous Page | Next Page

  1. Agustin's Linux Manual
  2. System Administration
  3. About the Author
  4. Contents
  5. Administration
  6. Terminals
  7. Command Basics
  8. Root Directory
  9. Executing Commands
  10. File specs
  11. File Permission
  12. How permissions are assigned
  13. Change ownership chown
  14. Running multiple commands
  15. Killing Processes
  16. Bash configuration files
  17. VI Editor
  18. Creating path environment
  19. Midnight Commander
  20. Linuxconf Utility
  21. Networking
  22. Domain Name Service DNS
  23. Router and Gateway
  24. Adding Users
  25. User Accounts
  26. Managing Groups
  27. Mounting File System
  28. NFS Mounts
  29. Disk Quotas
  30. Run levels
  31. Linuxconf Control
  32. Mandrake Control Center
  33. Creating a Boot Disk
  34. Switching Boot Mode
  35. Hardware Configurations
  36. Printer Configuration
  37. Installing Printers
  38. Samba Printer
  39. Managing services
  40. Managing Users
  41. Program Scheduler
  42. Software Management
  43. Installing CUPS

Executing commands as root

Let's have some fun with root so you can see what root can do. We are going to be writing in a home account named user1

[root@server2 agustin]# cd /home/user1

Create a directory using: mkdir

[root@server2 user1]# mkdir collections

Change to directory collections

[root@server2 user1]#cd collections
[root@server2 collections]#

So far we created a directory called collections, we moved into it and now collections is our current working directory. You can send data to a file or device on the fly by using the echo command.

[root@server2 collections]#echo paste this information to a file < myfile

So how do you know the information has been sent to myfile

The cat command

[root@server2 collections]#cat myfile
paste this information to a file

[root@server2 collections]#

At this point, you should have a file in your collections directory, create another directory

[root@server2 collections]# mkdir onother
[root@server2 collections]#ls
 afile	file2	myfile	onother/

[root@server2 collections]#

We can easily make a back up of a file inside our current directory; this is useful when you need to edit a file. For security reasons always backup a file when you need to edit it.

The copy command: cp

[root@server2 collections]#cp myfile original.myfile
[root@server2 collections]#

To view the content of a directory with details, we just add some switches to our ls command.

[root@server2 collections]#ls l
-rw-r--r--1 rootroot6        Aug 1709:09 afile
-rw-r--r--1 rootroot27       Aug 1709:46 file2
-rw-r-- r--1 rootroot14       Aug 1709:46 myfile
drwxr-xr-x2 rootroot4096   Aug 1710:34 another/
-rw-rr--1 rootroot14       Aug 1710:46 original.myfile

[root@server2 collections]#

These parameters are useful when digging inside directories. There are many others that you may want to look at. l R n I a all

[root@server2 collections]#man ls

Use man ls to read the manual and look at all the switches available to the command. Use the up and down arrow to scroll the manual page and press q to exit the manual.