Linux Basic Commands by Sami Zhioua

These are the very basic linux commands discussed in the lecture. Remember that this is just an introduction and these are really the very basics of linux commands. You can find online plenty of docs and tutorials about more advanced commands and uses.

Command syntax:
command_name [options] [arguments]
 

to have details about a command:
man command_name
 

ls: lists the files in a folder
ls -l
ls -a
 

cd: to move between folders
 

cp: to copy files from one location to another
cp -r (copy recursively)
 

mv: to move files
mv -i waits for confirmation in case of overwriting

rm : removes a file
rm -r : removes recursively the directories
 

mkdir: creates a directory
 

rmdir : deletes a directory
 

chmod: changes the access permission of a file
three types of owner: user, group, others
access modes: read, write, execute
 

gzip, tar : compression
To unzip a compressed tar.gz file: tar -zvzf file_name.tar.gz

find : to search for files
to find all c files in the current directory: find . -name '*.c'
 

grep : searches for a specific string in file(s)
grep buffer 007_hack3.c

to look for all occurrences of the word "buffer" in all c files, we have to combine two commands together.
this is done with pipelining
find . -name '*.c' | xargs grep buffer
 

ps : lists all the running processes
to list all processes: ps -A
to look for a particular process : ps -A | grep skype
kill: kills a process by its id.