0% found this document useful (0 votes)
0 views

Linux Commands

linux commands

Uploaded by

waxilek812
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Linux Commands

linux commands

Uploaded by

waxilek812
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ls - present directory

cd - change directory

pwd - present working directory (path)

cp - copy

mv - move

mkdir - create directory

cd .. - move to preceding directory

touch - create text file

$ - shows regular user

sudo - used by ADMIN or the ROOT user to do tasks for other users

ls -R - access directory within a directory(show all the folders within a


directory)

ls -a - access hidden files

touch .(filename) - create hidden file

ls -l - shows list in long format

ls -lrt - sort list from old to new

ls -r - reverse the order of the list

ls -t - sort by time modified

clear - clean the terminal

history - shows all the commands that have been given

echo _ print the terminal


printf

apt - install softwares

chmod - change file mode

ps - current processes running

ps -a - background processes

top - all the processes

-------------------------------------------------------------------------
----------

VI EDITOR COMMANDS

VI EDITOR is a text editor used by all linux programs, which is very


powerful
(alot of resources) ,yet little tricky to learn.

There are two types of operations in the VI editor:-

1. COMMAND OPERATIONS : All the operations that are performed in the


editor (except text manipulation)
is done by the command operations. Eg. -
moving cursor across file

- saving the file

- delete

- cut/copy/paste, etc.

2. INSERT OPERATIONS : All the text manipulation is done by the insert


command, in simple terms
all the text related stuff , comes under the
insert command.

* We use 'HJKL' to move cursor through keyboard


H - left
J - up
K - down
L - right

* To enter the INSERT MODE or, in simple terms to start writing in (vi)
we first press "i" button from the keyboard ,which enables the INSERT
MODE,
then start writing what we want.

* To go to the LAST LINE MODE , first press "esc" button then press the
":" button

* To SAVE a file , first go to the command mode, then type "wq" (means
write quit)
hit the enter button

* To COPY a line , first go to the line that you want to copy , then
press the "y"
button twice, then go the destination where you want to paste the
copied file ,
then press the "p" button.

* To DELETE a line , first go to the line that you want to delete , then
press the "d"
button twice.

* To SEARCH a word , go to the command mode then type "%s/(word)" , hit


enter.
* To SEARCH and REPLACE , again go to the command mode and type
"%s/(search_word)/(replace_word)"
, hit enter.

* To EXIT from (vi) , go to the command mode, then type ":q" [ you can
also exit from the
vi editor( without saving changes ) by just typing ":q!" ]

You might also like