Linux Basic

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Basic Linux Commands

[Edition 9]
[Last Update 161205]

For any issues/help contact: support@k21academy.com

1
support@k21academy.com
Table of Contents
1 Introduction .................................................................................................................................... 3
2 Documentation............................................................................................................................... 4
2.1 Documentation Links ......................................................................................................................... 4
3 Basic Linux Commands ............................................................................................................... 5

2
support@k21academy.com
1 INTRODUCTION

This guide is activity guide related to Linux basics commands required for each Training. This
guide covers:
 Basic Linux commands

3
support@k21academy.com
2 DOCUMENTATION

2.1 Documentation Links


Here are some of the links to study about Linux commands

 http://www.tecmint.com/useful-linux-commands-for-newbies/

 http://www-uxsup.csx.cam.ac.uk/pub/doc/suse/suse9.0/userguide-

9.0/ch24s04.html

 http://www.comptechdoc.org/os/linux/usersguide/linux_ugbasics.html

If you need more documents then contact us at support@k21academy.com

4
support@k21academy.com
3 BASIC LINUX COMMANDS

To begin working in the terminal mode, you will need to open a terminal. This can

be accomplished by clicking on Applications -> System tools -> Terminal or by

using right click and then click Open Terminal.

Note: Linux commands are case-sensitive.

S.No. Command Example Description

1. mkdir mkdir /abc Creates a new directory named abc inside

root (/) directory.

mkdir abc Creates a directory named abc inside the


current directory.

2. cd cd /var Changes current working directory to /var.

( var directory is present inside root(/)

directory)

cd var Changes current working directory to var

present under current directory.

3. pwd Pwd Shows what directory( folder) you are in.

4. cd .. Var]$ cd .. Moves up one directory. ( here you are

/]$ currently in /var directory when you type

cd .. you prompted to / dir as var dir is

inside /dir.

cd Moves up to home directory.

5
support@k21academy.com
5. ls ls / List all the files and directories present

inside / dir except for hidden files.

6. ls –a ls –a / (ls –a) List all the files and directories

ls -l ls –l / present inside / dir including hidden files as

well.

(ls –l) List all the files and directories with

detailed description of the permissions set

on them.

7. vi vi xyz Creates a new file in the current working

directory. After typing this command you

can move inside the file and can read,

write and can save the content and exit by

:wq!

 If the file name xyz already exists

you can edit the content of the file

by firing the same command vi

Note: To know more about vi Editor

commands, read out the below link

https://www.tutorialspoint.com/unix/unix-vi-

editor.htm

8. cat cat xyz Displays the contents of the file on the

screen

6
support@k21academy.com
9. rmdir rmdir abc Deletes the empty directory from the

current working directory. ( here abc

directory is already empty so it can be

deleted via rmdir command)

10. rm -rf rm -rf abc Deletes the non-empty directory from the

current working dir.(here abc dir is having

some files and folders in it so it is deleted

via rm –rf command).

Note: Please be careful while using this

command as it will remove data

permanently.

11. cp cp[source][target] Copies the file from source file to target

file( assuming target file has already been

created)

12. mv mv[data1][xyz] Moves file data1 to the directory xyz and

deleting the previous location of the file.

This command can also be used to

rename a file.

13. man man ls Manual for the linux commands. This

man cp command brings up online UNIX manual. It

man mv can be used to see the description of each

man cd command including the no. ways you can

7
support@k21academy.com
etc. etc. use it.

14. clear Clear Clears the visible area of the console.

15. ifconfig Ifconfig Displays the IP Address of the machine if

user is root.

/sbin/ifconfig Displays the IP Address of the machine if

user is other than root.

16. hostname Hostname Displays the hostname of the machine.

Note: These are some basic commands. There are many more commands than listed

in current document. So please go through the links given in Section 2 Documentation

to know more commands.

8
support@k21academy.com

You might also like