Thursday, May 29, 2008

Questions

1. Login to your account and enter fallowing commands,What arethe observation?


  • ls
  • pwd
  • uname -a
  • ls
  • ls /..
  • man pwd
  • cal
  • mkdir
  • mkdir lab1dir
  • ls
  • cd lab1dir
  • pwd
  • touch lab1 file
  • ls-al(Can you tell how big the file is ?)
  • rm lab1 le
  • pwd
  • clear
  • passwd
  • echo Hello world
  • date
  • hostname
  • dmesg more
  • uptime
  • sleep 10
  • who am i
  • sleep 10 &
  • who
  • sleep 1000
  • Ctrl + z
  • bg
  • jobs
  • kill %jobnumber
  • id
  • last
  • echo $SHELL
  • who
  • yes Hello World
  • CTRL + L
  • history
  • cd Desktop/ && mkdir lab1dir2
  • cd labidir2
  • cp /usr/share/doc/packages/yast2-installation/COPYRIGHT.english .
  • cp COPYRIGHT.english /home/eng/lab1dir/
  • ls /home/chathura/lab1ddir/COPYRIGHT.english
  • rm lab1dir2 jj ls
  • rm -r && ls
  • mkdir Desktop/lab1dir3
  • ls -al lab1dir1
  • ls -al lab1dir3
  • mv lab1dir1/COPYRIGHT.english Desktop/lab1dir3
  • cd Desktop/lab1dir3 && ls -al
  • mv COPYRIGHT.english copy.eng
  • grep -i 'freedom to' copy.eng
  • grep -n 'freedom to' copy.eng
  • su
  • reboot

Wednesday, May 28, 2008

Linux Basic (commands 2)

4 File/Directory command

$> ls
directory listing
$> ls -al
formatted listing with hidden les
$> mkdir testdir
create directory testdir
$> cd
testdir change directory to testdir
$> .
the current directory
$> ..
parent of the current directory
$> *
called a wildcard,and will match aginst none or more character
$> ?
Will match exactly one character
$> cd
change to home-directory
$> cd
change to home-directory
$> cd..
change to parent directory
$> pwd
display the path of the current directory
$> cp file1 file2
copy file1 and call it file2
$> mv file1 file2
Move or Rename le1 to le2
$> cp -r testdir1 testdir2
copy testdir1 to testdir2;create testdir2 if it doesn't exist
$> rm file1
Delete file1
$> rm -r testdir
Delete directory testdir
$> rm -rf testdir
force remove file
$> rmdir directory
remove a directory
$> cat file
display a file
$> less file
display a file a page at a time
$> head file
display the first few lines of a file
$> tail file
display the last few lines of a file
$> cat > file
redirect standard output to a file
$> wc file
count number of lines/words/characters in file
$> more file1
output the contents of file
$> cat >>file
append standard output to a file
$> touch
Create or update file
$> nl
Number line
$> stat
Display le attributes
$> du
Measure disk usage
$> file
Identify file types
$> diff file1 file2
Show the diferences between file

5 Managing users


$> useradd
create a new user account
$> passwd
change user password
$> su username
Switching accounts

6 System information

$> man command
lists the information on command
$> hostname
Print the name of the local host
$> whoami
Print login name
$> id username
Print user id and group id ...
$> date
Print or change the operating system date and time
$> whoami
Print login name
$> who
Determine the users logged on the machine
$> finger username
System information about a user
$> last
Show listing of users last logged-in on your system
$> history more
Show the last commands executed from the command line on the current account.
$> uptime
Show the amount of time sime since the last reboot
$> free
Memory information
$> df -h
Print disk info about all the le systems
$> cal [[month] year]
print a calender to standard output
$> tty
Print the name of the terminal in which you aretypeing this command
$> cat /proc/cpuinfo
CPU information
$> cat /proc/version
Linux version and other information
$> arch
Print machine architecture
$> runlevel
Find the current and previous system runlevel

7 File Comparison

$> gzip
zip a file to a gz file
$> gunzip
unzip a gz file
$> tar -cf File.tar
file create a tape archiver(no compressing)
$> tar -xf File.tar
extract the les from File.tar


8 Process Management

$> ps
List the processes currenttly run by the current user
$> ps aux
view all processes of all users
$> top
Keep listing the currently running processes,sorted by cpu usage
$> pgrep
process view the process id of a process
$> process &
To run a process in the background
$> kill processId
kill(terminate or signal a process)

9 Package Management

$> rpm -ivh pakege-name
Installing RPM packages
$> rpm -e pakege-name
unistalling RPM packages
$> rpm -Uvh pakege-name
Upgrading RPM packages

Wednesday, April 9, 2008

Linux Tutorial(linux command -1)

Most Linux systems have two basic modes for a system to run in text console mode or in graphical mode.

Login

Graphical mode

you will connect to the system using graphical mode when you are asked for your user nameand password.After entering your user name and password,it can take a little while before the graphical environment is started.To continue this exercise you will need to open a terminal window This terminal shows a standard prompt, which displays the user's login name,and the current working directory.

Text mode
Soon after the Linux started ,it will prompt user as login: for the username and password: for the password of the corresponding user.if the above operations are sucsessfull,the useris logged in to the system and given the prompt similar to terminal window prompt


Logout
If you want to logout current,type exit you can also use logout for the same effect

Switching account


logging in with a different account using su
$> su username
if it's right password you get identity and the right of the typed user

Virtual Consoles
  • Ctrl + Alt + F1
Switch to the first text terminal.Under Linux you can have several
(6 in standard setup) terminals opend at the same time
  • Ctrl + Alt + Fn (n=1...6)
Switch to the nth text terminal

  • Ctrl + Alt + F7
Switch to the first GUI terminal(if X-windows is running on the terminal)


  • Ctrl + Alt + Fn (n=7...12)
Switch to the nth GUI terminal

Control keys


The following control keys may be used to edit the command line and to affect the behaviourof running programs


  • Tab

    (in text terminals) Autocomplete the command if there is only one option,or else show all the available options
  • Arrow Up

    Scroll and edit the command history
  • Ctrl + Alt + BkSpc

    (In X-window) Kill the current X-windows server.Use if the X-windows sever crus-hes and can't be exited normally
  • Ctrl + Alt + Del

    Shut down the system(for a user at the text-mode console)
  • Ctrl + C

    Kill the current process
  • Ctrl + A

    Moves to start of line
  • Ctrl + E

    Moves to end of line
  • Ctrl + D

    Moves to end of file
  • Ctrl + W

    Erases one word in the Current line
  • Ctrl + U

    Erases the whole line
  • Ctrl + R

    Type to bring up recent command