Linux Class Notes
Linux Class Notes
Why linux?
*linux is best suited for multiuser and multitask application.
*linux is more attractive because it comes free of cost,open source software
Note-unix and linux are case sensitive
*linux has very important concept called 'terminal",is the gateway to the linux
os.
Properties of Linux
Linux Pros
----------
• Linux is free
• Linux is portable to any hardware platform:
• Linux was made to keep on running:
• Linux is secure and versatile:
• Linux is scalable:
• The Linux OS and most Linux applications have very short debug-
times
Linux Cons
----------
• There are far too many different distributions
• Linux is not very user friendly and confusing for beginners
example of linux OS
Debian,Ubuntu,Fedora,Arch linux
File management
---------------
command used to create files are
*touch
*cat
touch <filename1.ext> <filename2.ext>
touch filename{1..10}.txt
How to open multiple files in vim editor
vi <firstfilename> In vim give :tabnew <secondfilename>
touch directory/filename --> this command create a file in a directory directly
this command creates the file
cat: its echoes what you typed
*cat: concatenate files and print on the standard output
cat file_name:display the contents of the file
cat dir1/filename
cat -b filename : add the line numbers to non-blank lines
cat -n filename : add the line numbers to all lines
cat > filename : '>' this redirects and open the file for edit
cat >> filename : '>>' this appends and edit without overwriting the previous data
of file
cat file1 > file2 this command redirect the contents file1 to file2
cat dir1/filename display the content of the filename.
Make Directories
----------------
mkdir <directory_name>: make directory
mkdir <name1> <name2> <name3>
mkdir <name1>/<name2>
mkdir dir{1..10}
mkdir -p <name1>/{name2,name3,name4}
mkdir -p <name1>/<name2>/<name3>/<name4>
mkdir -pv <name1>/<name2>/<name3>/<name4>
mkdir -p its creates the directories with parent directory with sub directory
mkdir -pv print a message for each created directory
ls -R list out the directory structure
copying directories
********************
cp :{souce file/dir to destination file/dir}
cp sum1 sum2; [sum1 is copied to sum2]
cp filename{1..10}.txt directory
cp -r dir1 new_dir {it creates a new_dir and copies the content of dir1}
cp -r dir1 dir3 { if dir3 already exists,it will copy the dir1 to dir3}{
cp -i without overwrite
cp ../test1.txt ../test2.txt . from previous directory it takes the files and copy
to current directory [dot represent current directory]
Move Directories/files