Linux® is an open-source operating system (OS). An operating system is software that directly manages a system’s hardware and resources, like CPU, memory, and storage. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.
For more info, please visit: https://www.redhat.com/en/topics/linux/what-is-linux
Linux Features:
1. Linux is Secure Operating System
2. Free Available no License
3. Virus Free OS why because it does not use Executable file
4. Fast Operating System because it is CLI, Command Line Inter.
5. Open-source Code (.php)
6. Root "Power Full User"
LINUX SHELL: SHELL SIMILAR TO CMD, WHICH WE CAN EXECUTE COMMANDS.
1. bash: Barun again shell, Linux shell [root@local]$(user) or #(root)
2. sh: shell, it is a Unix shell
3. csh/tsh: this shell use Programmer
4. ksh : Korn shell Programmer, Developer
5. nologin : /sbin/nologin
Linux File system: A file system is a Function in which we organize disk & Partition. It is the structure of Disk Management.
File system Linux : ext3, ext4(unlimited Partition), xfs(Virtual)
Windows file system : fat32, ntfs , resilentFS
Root Directory File System (COMPUTER)
/boot : it Contains Booting File "Grub"
/home : it contains User information | users
/root : it is root home directory | administrator
/sbin : it is root Command Execution Folder
/bin : it is user Command Execution Folder
/dev : it contains Hardware Information | Device Management
/var : it contains web file, ftp file & message
/usr : it contains Reference Package /software
/mnt : Default Mount folder use for multipurpose mounting
/run : Mount DVD in Linux
/etc : it is use for Linux Configuration
/lib : it is library which contain Reserve Package
/proc : It contains all device related process | Task Manager
/opt : it’s optional
/tmp : temporary folder
/media : use for any media, Pendrive, DVD, camera
These are systems files you need to be familiar with. Each section has different files with a different purpose. Now, we move to major commands you need to be aware of before you start. Remember we are helping you with course requirements. So we will not focus on much theory.
Top 15 Basic commands you need before you start Linux.
1. To find information about networks: ifconfig
Note: this command is the same for all Linux-based operating systems. For windows, it does not work. You have to use ipconfig. Do not get confused.
2. To see present working Directory: PWD
3. Creating any folder: mkdir
i. To create a single file: mkdir new file(any name)
ii. To create nested file: mkdir –p new file/ newfile2/ newfile3
iii. To create hidden file: mkdir .newfile4
4. To change working directory: cd
i. To move one step back: cd ..
ii. To directly move to root file: cd \
iii. To move three-step back: cd ../ …
5. To list files and folders: ls or ll
Use commands as ls –a –l –i
-a means all, -l means with permission(read and write), and –i mean with index numbers
6. To create a file: there are 5 methods to create files in Linux. You can use any of them.
i. Touch filename: creates a blank file
ii. Gedit filename: opens notepad and writeable window
iii. cat > filename: create file
While using a cat you can have multiple functions. To display the content of the file, use cat filename without any operators. If you want to edit the files, use cat >> filename (with double operator)
iv. using command echo. This command has much more flexibility. You can directly create files and update your content on the same window (terminal).
To create and write a file, use echo “…….content……” > filename
To edit the file, use echo “…..updated content….. >> filename
To view, the file simply use the cat filename
v. using vi
you simply use the vi filename and press “i” to write the content. After inserting data, press esc and :wq. This helps to write the content, save it and exit the file. W means save, q means quit.
7. To copy files and folders: cp –arvf file1(to be copied), file2(to be pasted)
Where,
· a-archive means next copy possible
· r-reverse
· v- verbose means display information
· f- force
8. To move/cut files/rename: mv
Mv file1 file2 (move/cut)
Mv oldname newname (rename)
9. To remove files and folders: rm
rm file1 (for files)
rm –rf folder1 (for folder)
10. To use shortcuts: alias
alias x= ‘mkdir –p’
It means p files is created which is aliased with x. so whenever you search for the p folder, you can simply press x.
11. To display lines: Head/Tail
Head –x directory (location). This is for displaying line from the start.
Tail –x directory (location). This is for displaying lines from the bottom.
X can be any value number you want to see.
Suppose you want to see line number 99. Use head -99 /Downloads/file1 or any location with the file.
12. To count word: wc
wc –l –c –w /etc/passwd
Where,
· wc- word count
· l – line
· w- word
· /etc/passwd – location of the file
13. To see running tasks: ps
Ps –ef or all
If you want to kill some process, use kill process id. The process id is assigned numbers you can find on each process. Each id is always unique.
14. To locate any file: Locate
Locate filename/locaion of files.
15. CRON in Linux
CRON is used for running specific tasks at a regular interval of time. It is like windows task schedulers. Below is a sample of how to use it.
***** /path/to/script.sh
Look carefully, there are five stars. Each start has a specific meaning and you should be careful about how you are using it. These stars denote time: minute, hour, day, month, and a year respectively. If you want seconds, you have to add an extra one star.
/path/to/scripts is a task that will be running till the given time. So let’s look at how to run it.
Before assigning tasks, you have to create one.
i. Crontab –l –this list user cron table
ii. Crontab –e – it creates a new cron table
iii. Crontab –r – it removes a cron table and all
Now pattern to assign the task. Use crontab –e
You will be required to assign time. So use
47 8 12 1 4 any task you want to run.
It means your task will run for 4 years 1 month 12 days 8 hours and 47 minutes.
These are basic commands you need to be familiar with. Always remember, the more commands you execute, the more you increase the way of interaction with Linux. So always keep practicing.
Comments