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