42
This slides for every one who want to learn Linux This slides for every one who want to learn Linux in our in our Arab World Arab World and the and the whole World whole World .. .. Thanks Thanks for every one who for every one who sharing sharing us his experience us his experience and and help us help us to learn linux to learn linux .. .. :) :)

Linux Basic Commands

Embed Size (px)

DESCRIPTION

Learn Linux Basic commandsBy: Students from Jordan UniversityNadine ShorbajiHanan Nimer

Citation preview

This slides for every one who want to learn LinuxThis slides for every one who want to learn Linuxin our in our Arab WorldArab World and the and the whole Worldwhole World.. ..

ThanksThanks for every one who for every one who sharingsharing us his experience us his experience and and help ushelp us to learn linux to learn linux ....

:):)

man hierman hier

1. Open terminal:

2. Type:

How Linux is Organized??!How Linux is Organized??!

Cli : Command Line interface..Cli : Command Line interface..

1. Open terminal:

2. Type:

  cat  /etc/shellscat  /etc/shells

  *What is MyShell:*What is MyShell:      $ echo  $SHELL $ echo  $SHELL 

* Change Shell:* Change Shell:  $ chsh  $ chsh  

$ command   ­options   parameter $ command   ­options   parameter 

whoamiwhoamihostnamehostname

user @ computer­name:~ $ user @ computer­name:~ $ 

userusercomputer­namecomputer­name

pwdpwd

    user @ computer­name:~ $ user @ computer­name:~ $ 

User Home FolderUser Home Folder

/home/user1/home/user1

Magic command

Sudo : Super User Do

sudo susudo su

sudo -isudo -i

Switch user : su

su user-namesu user-name

passwdpasswd

Change user passwordChange user password

Users logs

-Who logged in:$ Who or w

-Last Sessions:$ last

Change Directory: cd

cd . cd .

cd ~cd ~

cd /cd /

cd Desktop/cd Desktop/

cd cd

cd .. cd ..

List Files: ls

ls ls

ls -als -a

man ls man ls Get Get manualmanual

ls directoryls directory

ls -l file||dirls -l file||dir

Create Directory : mkdir

mkdir UBUNTU mkdir UBUNTU

Remove Directory : rmdir

rmdir UBUNTU rmdir UBUNTU

Create File

touch <file1> <file2> <....> touch <file1> <file2> <....>

cat > file-name cat > file-name

cat >> file-name cat >> file-name

newnew

updateupdate

Remove File

rm path/file-name rm path/file-name

Read File

cat path/file-name cat path/file-name

You can also do stuff like rm b* with theasterisk. For removing a collections of filesstarted with litter b.

Reading Files

head -# file-name head -# file-name

tail -# file-name tail -# file-name

less path/file-name less path/file-name

more path/file-name more path/file-name

gedit path/file-name gedit path/file-name

Text Search : grep

g/re/p (global / regular expression / print).g/re/p (global / regular expression / print).

grep -i pattern file-name grep -i pattern file-name

grep -v pattern file-name grep -v pattern file-name

grep -w pattern file-name grep -w pattern file-name

ignore case

as 1 word

all except patt

*.txt

/directory

● whereis ls : Display information about the location of a command

• which ls : Display which version of acommand will execute .

• pwd: print working directory

Continued....

Try...

• Try man –f ls whatis ls

• Try man –k ls apropos ls

Reboot

sudo rebootsudo reboot

ShutDown

sudo shutdown -r NOWsudo shutdown -r NOW

sudo shutdown timesudo shutdown time

sudo shutdown -c timesudo shutdown -c time

Copy Paste : cp

cp -r dir/* new-directorycp -r dir/* new-directory

cp <file1> <file2> <dest>cp <file1> <file2> <dest>

Move + Rename : mv

mv path/file new-path/new-namemv path/file new-path/new-name

mv -r dir/* new-directorymv -r dir/* new-directory

User @ computer-name

User @ computer-name

Terminal

Terminal

User @ computer-name

User @ computer-name

User@computer-name:~

Terminal

Terminal

User@computer-name

User@computer-name

Search Tool

find <dest> -name file-namefind <dest> -name file-name

Linux files DB

Lets update linux files data base :

sudo updatedbsudo updatedb

locate file-namelocate file-name

Package Management

System >> Administration >> Synaptic Package Manager.

sudo apt-get install <pckg>sudo apt-get install <pckg>

Process management

ps auxps aux

System >> Administration >> System Monitor.

kill p-idkill p-id

pkill p-namepkill p-name

killall p-idkillall p-id

kill -9 p-idkill -9 p-id

xkillxkill

Process termination:

toptop

Launcher

Lets create my buttons...

gksudo firefoxgksudo firefox

Compression..

* Create .tar.gz compressed file:1. Create .tar file: $ tar -cvf new_name.tar folder_or_file2.Create .gz file: $ gzip new_name.tar

* Extract from .tar.gz compressed file:1. Create .tar file: $ gunzip new_name.tar.gz2.Create .gz file: $ tar -xvf new_name.tar

Linux Variables

$ echo $PATH$ echo $USER$ echo $SHELL