Skip to Content

CommandLine -1-

DJ KING's picture

GNU/Linux Command Line session (1) :

In GNU/Linux everything is a file ... All configurations have files Using the text mode on GNU/Linux Operating System is pretty light .. The following figure shows how does the system work on your GNU/Linux Operating System ( User - Utility - !Shell - Kernel - Hardware )

We have two types of Terminals :

  1. Virtual Terminal ---> cause there is no other machine ( as in figure 2 ) " A mainframe with terminals "

2 -Terminal Emulators ( Psuedo ) ---> from the GUI ( Graphical User Interface )

tty , pts :

try using the command tty from any GUI terminal ( psuedo ) , most propably you'll get something like : /dev/pts1 or /dev/pts now use the terminals through Alt+Ctrl+F1 .... F6

The general form of any command is like :

  • command -option []

[] == argument

man -k is your friend ..

What manual page do you want?

usage of man -k is something like :

so you can get use of it when you don't know the specific command to get it's manual directly like

man is the short name of manual and you can use the command info as well which is a documentation browsing system

  • ___/
  • |
  • |___/bin
  • |
  • |___/boot
  • |
  • |___/dev
  • |
  • |___/etc
  • |
  • |___/home
  • |
  • |___/initrd
  • |
  • |___/lib
  • |
  • |___/lost+found
  • |
  • |___/media
  • |
  • |___/mnt
  • |
  • |___/opt
  • |
  • |___/proc
  • |
  • |___/root
  • |
  • |___/sbin
  • |
  • |___/srv
  • |
  • |___/sys
  • |
  • |___/tmp
  • |
  • |___/usr
  • |
  • |___/var

Old School ASCII Graphics ;)

the famous command cd

Touch command ..

for more information about the “ touch “ command

cp ( the copying command )

pwd : print working directory

some other commands you may find it usefull ..

which :

shows the full path of (shell) commands.

whereis :

whereis locates source/binary and manuals sections for specified files

who :

tells who is logged on

whatis :

whatis searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output. Only complete word matches are displayed.

whoami

print efictive userid same as id -un

env print environment values try it on your machine cause the result is long to be copied in here ..

echo : display a line of text

GNU/Linux is fun .. isn't it ? ;)

Permissions :

you'll find the following for an example :

the first part on the left is called “ Permissions “ 10 charachters can be divided into three sections

for an example : -rw-r—r-- in learning these permissions first of all we must divide them into the 3 parts i have just told you about -|rxw |r-- |r--

1 2 3

the first - means regualar type ( other types such as -d ( directory ) or c ( charachter device )

r : read

w : write

x : execute

  1. user ( who has created that file/directory )
  2. group
  3. anyone else ( others )

in the same example we can notice easily that the user (1) can read (r) , write (w) and execute(x) where the group and others can only read (r)

to change these permissions we use the command line “ chmod “

we can do that using two methods

where (u)ser (g)roup (o)thers

we can change the permissions in an easier way using numerical numbers as i said earlier the attributes are divided into three parts

r w x | r w x | r w x

4 2 1 | 4 2 1 | 4 2 1

say that we have a file that we want to make it readable , writable and executable for the user , !executable by the group , readable and writable for the others

user | group | others

r w x |r w x | r w x

4 2 1 0 0 1 4 2 0

add every section of the 3 and it should give a number of 3 patterns in the end

user = 4+2+1 = 7

group = 0+0+1 = 1

others = 4+2+0 = 6

then simply the command will be

Comments

ezabi's picture

So you get the session

Cool, looks like you're aiming at owning the command line session, well it's yours, go add your name. So long and thanks for all the fish.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


Dr. Radut | book