
Step by step guide to Linux for beginner
Linux tutorial for beginner
5 December, 2022
3
3
0
Contributors
Hi Techies
Hope you all are doing good, This time I am going to share a complete guide to LINUX for beginners, so let's get started.
SO, What is Linux? Well I strongly believe if you are from a computer science background you have at least basic idea about LINUX, but let me share a basic idea.
Linux is basically a Operating system Kernel, which is more secure than most of the operating system available in the market, it is light weight and free to use or what we can call as an open source operating system, and that is the beauty of this OS, which not only makes it a stronger OS but also makes it's community one of the biggest.
As a programmer or software developer I believe Basic Operating system concepts, and Linux commands are necessary, because all the software firms use Linux and prefer it over others.
Before jumping right into it let me clarify few things:
1.If you have a Linux system it's great.
2.If you have a windows system you can install ORACLE VM BOX, in order to run the linux commands.
3.you also need the UBUNTU operating system.
Both of these are available in their official sites. Once you are done, then set up the vm box, if got stock take the help of youtube. And now we are good to go, In order to run linux commands open the terminal, where "~" signe represents the home directory. you can now type these following command, and play around them to get familiar with.
1. man: show the manual of any command.
(fun fact😂🤣😃: If you use this
command you don't even need my description, because it will provide you that,
but yes, this blog can help you understand all these command in a easier
language)
Ex: man cd
2.pwd: Stands for Print Working Directory
Ex: pwd
3. cd: stands for change directory
Ex: cd, cd directory/ (cd will directly take to
the default directory)
Ex 2: cd (Move one directory up)
4. ls :gives the detailed contents(files, folders, …etc) of the current directory.
Ex: ls
5. ls -a: show the hidden files as well.
6. ls -l: show the files in a table format with details
7. ls -la : show the all the files with the hidden files with details
8. ls -lah : show the files in a human readable format. (their will be k or m…etc for
k.b and m.b respectively)
9. ls absolute_path : list out the files and folders in the specified path
Ex: ls /home/partha/Documents/
10. mkdir: create a directory/folder
Ex: mkdir Partha (Partha Folder will be created)
11. mkdir -p : create multiple folders at a time
Ex: mkdir -p psm/raja/pmpp
This command will create a “psm” folder in which
it will create a “raja” folder inside that it will again create a “pmpp”
folder.
12. rm: delete a file.
a. rm filename with extension
b. rm -d directoryname {delete the directory (--dir can also be used)}
c. rm file1 file2 (delete multiple files)
13. rm -i: delete in a interactive way
Ex: rm -i psm1.txt psm2.txt (This will ask for
confirmation before deleting files)
14. rm -rf : delete a folder/ directory
Ex: rm -rf directory name
15. rmdir: delete directory
Ex: rmdir directory name
16. rmdir-p : delete the whole file tree
Ex: I have a folder “psm” in which their is a
folder “raja” in which present folder “pmpp”, to delete all these folders we
can run a command i.e.
rmdir -p psm/raja/pmpp
17. In Linux if we put “.” in front of any file name it will be hidden, and can’t be
shown with “ls” command.
18. clear: cleans the screen
19. file: shows the details about the file
Ex: file name.txt
20. touch: create a file
Ex: touch partha.txt or touch psm.txt psm2.txt
21. cp :copy a file or directory
Ex: with in same directory : cp psm.txt psm2.txt
(Copy the psm text file and paste it in
the same directory by renaming it into psm2.)
Ex: copy for another directory : cp psm.txt
/home/partha
(copy psm.txt from current directory to partha
directory)
22. cp -r: copy a directory
Ex: cp -r partha parthacp (create a copy of
partha in the same directory as parthacp)
23. mv :we can use this for moving a file/directory as well as renaming it
Ex: mv psm psm2 (rename the psm folder to psm2)
mv psm home/partha/psm3 (move the psm file to
partha directory and also renamed it to psm3)
24. head: print out the first 10 lines of a file
Ex: head partha.txt (print out the first 10
lines of partha.txt)
head -5 partha.txt (print out the first 5 lines
of partha.txt)
25. tail: show the last ten lines of a file.
Ex: tail psm.txt
26. cat :concatenate and print the whole file.
Ex: cat psm.txt (will print the content of
psm.txt file)
Ex: cat psm1.txt
psm2.txt psm3.txt
(print the content of all 3 files)
Ex: cat >psm.txt (let us write as many lines
as we want in psm.txt file in the terminal, we can come back from editing it by
pressing ctrl+d).
Ex: cat psm.txt > psm2.txt (creates a file
named psm2 and copy all the content of psm into it.)
27. echo: create a file and write something in it at the same time.
Ex: echo hi there. >psm.txt (created psm.txt
and wrote “hi there.” inside it.)
28. more: lets us traverse through a large file
Ex: more filename (by pressing “enter” we can
move forward in the file)
29. less: lets us traverse through the file, essentially in an opposite way as compared
to the more command.
Ex: less psm.txt
30. touch: create a file
Ex: touch partha.txt
31. “/” represents the root directory in Linux that includes all the directory and
file.
(move to bin and then try the 32. command)
32. ls -l: gives the full file structure of the os
a. By following 31. And 32. You will see a lot of directory, here is a general
overview of them and what they are meant for:
i.bin: store all the binary files, like core utilities
and commands(ex: cd, ls etc…)
ii.boot: very important file, just like c:/ drive
in windows, help the os in booting.
iii.cdrom: for using compact disk(cd)
iv.dev: helps using the hard drives
v.etc: stores all the configuration files
vi.home : all username folders are stored(all docs,
img etc.. are stored)
vii.libs: additional libraries for linux(like
program file in windows)
viii.Media: for external devices
ix.mnt: place holder folder(mounting external
devices)
x.Opt: for optional software
xi.Proc: processes folder, lot of system info
present, helps kernel in sending and receiving information from ongoing
processes
xii.root: home directory for root account(root is a
inbuilt account by linux)
xiii.sbin: this directory is just like bin user
with certain extra commands meant for root account
xiv.tmp: for storing files etc.. temporarily, gets
deleted once the system shuts down
33. uptime: shows for how long the system has been active, what is the load on it etc…
32. Free: give the memory usage
33. Ps -A: current running processes
34. df: gives a lot of information based on disk space
a. Df -h: in human readable format
35. fdisk: manipulate disk partition
a. fdisk -l: pulls out the information related to disk partition
36. top: gives detailed linux processes(press q to get out from the env)
a. htop: gives a better representation of top
37. ip: gives you the network detail
38. sudo: ves you certain special privilege access to some ports, similar to
windows(run as administrator).
39. apt(Advanced package management tool): used to install and update packages
40. sudo apt update: update the os with cache of linux software repository(repository is where all the linux software are stored)/ shows the upgradable packages available
41. sudo apt upgrade: upgrade the packages
42. sudo apt search package_name: search for the package in linux repo to install
43. sudo apt install package_name: install a package
44. sudo apt remove package_ame: remove a package
Text editors:-
47. Nano file_name: edit the file
a. ctrl+o+enter: save the file
48. Vim file_name: opens the file
a. i: enter to insert mode to write
b. (esc+ :) :
i. wq: save and exit.
ii. q! : exit without saving.
That is it basically, although some of the above concepts can be learnt in a more in depth fashion I think this will suffice your need as a beginner.
I hope this will help you in your journey of learning something new, Happy learning.
Keep coding, Keep smilig.
tutorial
beginner
linux
develevate