Sie sind auf Seite 1von 13

Basic Linux Commands

CS241
Basic Linux Commands
File Handling
Text Processing
System Administration
Process Management
Other commands
Basic Commands
man <command> - shows all the information about the
command.
Eg: man ls

sudo - allows a permitted user to execute a command


as the superuser.
Eg: sudo apt-get update
File Handling Commands
mkdir make directories
Usage : mkdir [option] DIRECTORY_NAME

ls list directory contents


Usage : ls [option] [FILE_NAME]

cd change directories
Usage : cd [DIRECTORY]
File Handling Commands
cp copy files and directories
Usage : cp [option] SOURCE DEST

mv move or rename files


Usage : mv [option] SOURCE DEST

rm remove files or directories


Usage : rm [option] FILE
Eg: rm file.txt , rm -rf some_directory
File Handling Commands
find search for files in a directory
Usage : find [option] [path] [pattern]
Eg: find ./test
find ./test -name test.txt
Text Processing
vim vi improved, a programmers text editor
Usage : vim [option] [FILE]

cat concatenate files and print on the standard


output.
Usage cat [option] [FILE]...
Eg: cat file1.txt file2.txt
Text Processing
wc print the number of lines, words and bytes in a
file.
Usage : Wc [option][FILE]
wc -l file.txt

sort sort lines of text file alphabetically


Usage : Sort [option] [FILE]
Eg : Sort file.txt
File Permissions
3 types of file permissions : read, write and execute.
Read permission - 4, write - 2, execute 1
rwx rw- r-- means the following :
-The owner can read, write and execute.
-The group members can read and write.
-Others can only read.
File Permissions
chmod - change the permissions of a file.
Usage : Chmod 777 file.txt
chown change file owner and group.
Usage : chown new_owner file.txt
Process Management
ps lists the current processes.
Eg : Ps -ef lists all the processes with full-format
listing.

kill terminates a process with signal mechanism.


Usage : kill [option] pid
Eg: kill -9 2275
Other commands
tar - to archive a file
Usage: tar [option] DEST SOURCE
Eg: tar -cvf /home/archive.tar /home/original
tar -xvf /home/archive.tar

Ifconfig - display information about all network


interfaces currently in operation.
Eg: Sudo Ifconfig eth0 up
Sudo ifconfig eth0 down
Thank You

Das könnte Ihnen auch gefallen