SlideShare a Scribd company logo
1 of 33
Linux Week 2
Linux Directories
Linux directories
• What are Commands
A command is an instruction given to our computer by us to do
whatever we want. In Mac OS, and Linux it is called terminal,
whereas, in windows it is called command prompt. Commands are
always case sensitive.
• Commands are executed by typing in at the command line followed
by pressing enter key.
• This command further passes to the shell which reads the command
and execute it. Shell is a method for the user to interact with the
system. Default shell in Linux is called bash (Bourne-Again Shell).
Linux directories
• The Root Directory
All the directories in the Linux system comes under the root directory
which is represented by a forward slash (/). Everything in your system can
be found under this root directory even if they are stored in different
virtual or physical devices.
Linux directories
• 1. / – Root
Every single file and directory starts from the root directory.
Only root user has write privilege under this directory.
Please note that /root is root user’s home directory, which is not
same as /.
• 2. /bin – User Binaries
Contains binary executables.
Common linux commands you need to use in single-user modes are
located under this directory.
Commands used by all the users of the system are located here.
For example: ps, ls, ping, grep, cp.
Linux directories
• 3. /sbin – System Binaries
Just like /bin, /sbin also contains binary executables.
But, the linux commands located under this directory are used
typically by system aministrator, for system maintenance purpose.
For example: iptables, reboot, fdisk, ifconfig, swapon
• 4. /etc – Configuration Files
Contains configuration files required by all programs.
This also contains startup and shutdown shell scripts used to
start/stop individual programs.
For example: /etc/resolv.conf, /etc/logrotate.conf
Linux directories
• 5. /dev – Device Files
Contains device files.
These include terminal devices, usb, or any device attached to the
system.
For example: /dev/tty1, /dev/usbmon0
• 6. /proc – Process Information
Contains information about system process.
This is a pseudo filesystem contains information about running process.
For example: /proc/{pid} directory contains information about the
process with that particular pid.
This is a virtual filesystem with text information about system
resources. For example: /proc/uptime
Linux directories
• 7. /var – Variable Files
var stands for variable files.
Content of the files that are expected to grow can be found under
this directory.
This includes — system log files (/var/log); packages and database
files (/var/lib); emails (/var/mail); print queues (/var/spool); lock
files (/var/lock); temp files needed across reboots (/var/tmp);
• 8. /tmp – Temporary Files
Directory that contains temporary files created by system and users.
Files under this directory are deleted when system is rebooted.
Linux directories
• 9. /usr – User Programs
Contains binaries, libraries, documentation, and source-code for second level
programs.
/usr/bin contains binary files for user programs. If you can’t find a user binary
under /bin, look under /usr/bin. For example: at, awk, cc, less, scp
/usr/sbin contains binary files for system administrators. If you can’t find a system
binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd,
userdel
/usr/lib contains libraries for /usr/bin and /usr/sbin
/usr/local contains users programs that you install from source. For example,
when you install apache from source, it goes under /usr/local/apache2
10. /home – Home Directories
Home directories for all users to store their personal files.
For example: /home/john, /home/nikita
Linux directories
• 11. /boot – Boot Loader Files
Contains boot loader related files.
Kernel initrd, vmlinux, grub files are located under /boot
For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-
24-generic
12. /lib – System Libraries
Contains library files that supports the binaries located under
/bin and /sbin
Library filenames are either ld* or lib*.so.*
For example: ld-2.11.1.so, libncurses.so.5.7
Linux directories
• 13. /opt – Optional add-on Applications
opt stands for optional.
Contains add-on applications from individual vendors.
add-on applications should be installed under either /opt/ or
/opt/ sub-directory.
14. /mnt – Mount Directory
Temporary mount directory where sysadmins can mount
filesystems.
Linux directories
• 15. /media – Removable Media Devices
Temporary mount directory for removable devices.
For examples, /media/cdrom for CD-ROM;
/media/floppy for floppy drives; /media/cdrecorder for
CD writer
16. /srv – Service Data
srv stands for service.
Contains server specific services related data.
For example, /srv/cvs contains CVS related data.
Linux Commands
• whoami
Use whoami to find out who you are logged in as or who is
logged into an unmanned Linux terminal
• pwd
Nice and simple, the pwd command prints the working
directory (the current directory) from the root / directory
• man
The man command displays the “man pages” for a command
in less . The man pages are the user manual for that
command. Because man uses less to display the man pages,
you can use the search capabilities of less
Linux Commands
• ls
This might be the first command the majority of Linux users meet. It
lists the files and folders in the directory you specify. By default, ls
looks in the current directory. There are a great many options you
can use with ls , and we strongly advise reviewing its the man page.
Some common examples are presented here
• mkdir
The mkdir command allows you to create new directories in the
filesystem. You must provide the name of the new directory to
mkdir. If the new directory is not going to be within the current
directory, you must provide the path to the new directory.
To create two new directories in the current directory called
“invoices” and “quotes,” use these two commands
Linux Commands
• mv
The mv command allows you to move files and directories
from directory to directory. It also allows you to rename files.
To move a file you must tell mv where the file is and where
you want it to be moved to. In this example, we’re moving a
file called apache.pdf from the “~/Document/Ukulele”
directory and placing it in the current directory, represented
by the single . character
• w
The w command lists the currently logged in users.
Linux Commands
• uname
You can obtain some system information regarding the Linux computer
you’re working on with the uname command.
Use the -a (all) option to see everything.
Use the -s (kernel name) option to see the type of kernel.
Use the -r (kernel release) option to see the kernel release.
Use the -v (kernel version) option to see the kernel version.
• less
The less command allows you to view files without opening an editor. It’s
faster to use, and there’s no chance of you inadvertently modifying the
file. With less you can scroll forward and backward through the file using
the Up and Down Arrow keys, the PgUp and PgDn keys and the Home and
End keys. Press the Q key to quit from less
Linux Commands
• tail
The tail command gives you a listing of the last 10 lines of a file. If you want to
see fewer or more lines, use the -n (number) option. In this example, we use
tail with its default of 10 lines. We then repeat the command asking for only
five lines.
• head
The head command gives you a listing of the first 10 lines of a file. If you want
to see fewer or more lines, use the -n (number) option. In this example, we
use head with its default of 10 lines. We then repeat the command asking for
only five lines
• sudo
The sudo command is required when performing actions that require root or
superuser permissions, such as changing the password for another user.
Linux Commands
• history
The history command lists the commands you have previously issued on
the command line. You can repeat any of the commands from your history
by typing an exclamation point ! and the number of the command from
the history list
• SSH
Use the ssh command to make a connection to a remote Linux computer
and log into your account. To make a connection, you must provide your
user name and the IP address or domain name of the remote computer
• shutdown
The shutdown command lets you shut down or reboot your Linux system.
Using shutdown with no parameters will shut down your computer in one
minute
Linux Commands
• grep
The grep utility searches for lines which contain a search pattern.
When we looked at the alias command, we used grep to search
through the output of another program, ps . The grep command can
also search the contents of files. Here we’re searching for the word
“train” in all text files in the current directory
The ps command lists running processes. Using ps without any
options causes it to list the processes running in the current shell
ping
The ping command lets you verify that you have network
connectivity with another network device. It is commonly used to
help troubleshoot networking issues. To use ping, provide the IP
address or machine name of the other device
Linux Commands
• passwd
The passwd command lets you change the password for a
user. Just type passwd to change your own password.
You can also change the password of another user account,
but you must use sudo. You will be asked to enter the new
password twice
kill
The kill command allows you to terminate a process from the
command line. You do this by providing the process ID (PID)
of the process to kill. Don’t kill processes willy-nilly. You need
to have a good reason to do so. In this example, we’ll
pretend the shutter program has locked up
Linux Commands
• groups
The groups command tells you which groups a user is a member of
• The gzip command compresses files. By default, it removes the original
file and leaves you with the compressed version. To retain both the
original and the compressed version, use the -k (keep) option
• free
The free command gives you a summary of the memory usage with your
computer. It does this for both the main Random Access Memory (RAM)
and swap memory. The -h (human) option is used to provide human-
friendly numbers and units. Without this option, the figures are presented
in bytes
Linux Commands
• finger
The finger command gives you a short dump of information about a
user, including the time of the user’s last login, the user’s home
directory, and the user account’s full name
find
Use the find command to track down files that you know exist if you
can’t remember where you put them. You must tell find where to
start searching from and what it is looking for
exit
The exit command will close a terminal window, end the execution
of a shell script, or log you out of an SSH remote access session
Linux Commands
• echo
The echo command prints (echoes) a string of text to the
terminal window
• diff
The diff command compares two text files and shows the
differences between them. There are many options to tailor
the display to your requirements
• df
The df command shows the size, used space, and available
space on the mounted filesystems of your computer.
Linux Commands
• Two of the most useful options are the -h
(human readable) and -x (exclude) options.
The human-readable option displays the sizes
in Mb or Gb instead of in bytes. The exclude
option allows you to tell df to discount
filesystems you are not interested in
Linux Commands
• curl
The curl command is a tool to retrieve information and
files from Uniform Resource Locators (URLs) or internet
addresses.
The curl command may not be provided as a standard
part of your Linux distribution. Use apt-get to install
this package onto your system if you’re using Ubuntu
or another Debian-based distribution. On other Linux
distributions, use your Linux distribution’s package
management tool instead
Linux Commands
• chown
The chown command allows you to change the owner
and group owner of a file. Listing our example.txt file
with ls -l we can see dave dave in the file description.
The first of these indicates the name of the file owner,
which in this case is the user dave. The second entry
shows that the name of the group owner is also
dave. Each user has a default group created when the
user is created. That user is the only member of that
group. This shows that the file is not shared with any
other groups of users
Linux Commands
• chmod
The chmod command sets the file permissions flags on a file
or folder. The flags define who can read, write to or execute
the file. When you list files with the -l (long format) option
you’ll see a string of characters that look like
cd
The cd command changes your current directory. In other
words, it moves you to a new place in the filesystem.
If you are changing to a directory that is within your current
directory, you can simply type cd and the name of the other
directory
Linux Commands
• cat
The cat command (short for “concatenate”) lists the contents of files
to the terminal window. This is faster than opening the file in an
editor, and there’s no chance you can accidentally alter the file. To
read the contents of your .bash_log_out file, type the following
command while the home directory is your current working
directory, as it is by default
alias
The alias command lets you give your own name to a command or
sequence of commands. You can then type your short name, and
the shell will execute the command or sequence of commands for
you
Linux directories
Any Questions
Linux week 2
Linux week 2
Linux week 2
Linux week 2
Linux week 2

More Related Content

What's hot

What's hot (19)

Linux basic commands tutorial
Linux basic commands tutorialLinux basic commands tutorial
Linux basic commands tutorial
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
 
Some basic unix commands
Some basic unix commandsSome basic unix commands
Some basic unix commands
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
Useful Linux and Unix commands handbook
Useful Linux and Unix commands handbookUseful Linux and Unix commands handbook
Useful Linux and Unix commands handbook
 
A Quick Introduction to Linux
A Quick Introduction to LinuxA Quick Introduction to Linux
A Quick Introduction to Linux
 
An Introduction To Linux
An Introduction To LinuxAn Introduction To Linux
An Introduction To Linux
 
Linux
Linux Linux
Linux
 
Unix OS & Commands
Unix OS & CommandsUnix OS & Commands
Unix OS & Commands
 
Linux commands
Linux commands Linux commands
Linux commands
 
Basics of-linux
Basics of-linuxBasics of-linux
Basics of-linux
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals  Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commands
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
 
UNIX/Linux training
UNIX/Linux trainingUNIX/Linux training
UNIX/Linux training
 
Terminal Commands (Linux - ubuntu) (part-1)
Terminal Commands  (Linux - ubuntu) (part-1)Terminal Commands  (Linux - ubuntu) (part-1)
Terminal Commands (Linux - ubuntu) (part-1)
 

Similar to Linux week 2 (20)

Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
Unix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptxUnix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptx
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01
 
Linux
LinuxLinux
Linux
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.
 
3. intro
3. intro3. intro
3. intro
 
cisco
ciscocisco
cisco
 
Linux
LinuxLinux
Linux
 
Linux administration training
Linux administration trainingLinux administration training
Linux administration training
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 
linux cmds.pptx
linux cmds.pptxlinux cmds.pptx
linux cmds.pptx
 
Linux 4 you
Linux 4 youLinux 4 you
Linux 4 you
 
LinuxCommands (1).pdf
LinuxCommands (1).pdfLinuxCommands (1).pdf
LinuxCommands (1).pdf
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
Linux
LinuxLinux
Linux
 
Linux: Everyting-as-a-service
Linux: Everyting-as-a-serviceLinux: Everyting-as-a-service
Linux: Everyting-as-a-service
 

Recently uploaded

Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...akbard9823
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一3sw2qly1
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 

Recently uploaded (20)

Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 

Linux week 2

  • 1. Linux Week 2 Linux Directories
  • 2. Linux directories • What are Commands A command is an instruction given to our computer by us to do whatever we want. In Mac OS, and Linux it is called terminal, whereas, in windows it is called command prompt. Commands are always case sensitive. • Commands are executed by typing in at the command line followed by pressing enter key. • This command further passes to the shell which reads the command and execute it. Shell is a method for the user to interact with the system. Default shell in Linux is called bash (Bourne-Again Shell).
  • 3. Linux directories • The Root Directory All the directories in the Linux system comes under the root directory which is represented by a forward slash (/). Everything in your system can be found under this root directory even if they are stored in different virtual or physical devices.
  • 4. Linux directories • 1. / – Root Every single file and directory starts from the root directory. Only root user has write privilege under this directory. Please note that /root is root user’s home directory, which is not same as /. • 2. /bin – User Binaries Contains binary executables. Common linux commands you need to use in single-user modes are located under this directory. Commands used by all the users of the system are located here. For example: ps, ls, ping, grep, cp.
  • 5. Linux directories • 3. /sbin – System Binaries Just like /bin, /sbin also contains binary executables. But, the linux commands located under this directory are used typically by system aministrator, for system maintenance purpose. For example: iptables, reboot, fdisk, ifconfig, swapon • 4. /etc – Configuration Files Contains configuration files required by all programs. This also contains startup and shutdown shell scripts used to start/stop individual programs. For example: /etc/resolv.conf, /etc/logrotate.conf
  • 6. Linux directories • 5. /dev – Device Files Contains device files. These include terminal devices, usb, or any device attached to the system. For example: /dev/tty1, /dev/usbmon0 • 6. /proc – Process Information Contains information about system process. This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid. This is a virtual filesystem with text information about system resources. For example: /proc/uptime
  • 7. Linux directories • 7. /var – Variable Files var stands for variable files. Content of the files that are expected to grow can be found under this directory. This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp); • 8. /tmp – Temporary Files Directory that contains temporary files created by system and users. Files under this directory are deleted when system is rebooted.
  • 8. Linux directories • 9. /usr – User Programs Contains binaries, libraries, documentation, and source-code for second level programs. /usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp /usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel /usr/lib contains libraries for /usr/bin and /usr/sbin /usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2 10. /home – Home Directories Home directories for all users to store their personal files. For example: /home/john, /home/nikita
  • 9. Linux directories • 11. /boot – Boot Loader Files Contains boot loader related files. Kernel initrd, vmlinux, grub files are located under /boot For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32- 24-generic 12. /lib – System Libraries Contains library files that supports the binaries located under /bin and /sbin Library filenames are either ld* or lib*.so.* For example: ld-2.11.1.so, libncurses.so.5.7
  • 10. Linux directories • 13. /opt – Optional add-on Applications opt stands for optional. Contains add-on applications from individual vendors. add-on applications should be installed under either /opt/ or /opt/ sub-directory. 14. /mnt – Mount Directory Temporary mount directory where sysadmins can mount filesystems.
  • 11. Linux directories • 15. /media – Removable Media Devices Temporary mount directory for removable devices. For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer 16. /srv – Service Data srv stands for service. Contains server specific services related data. For example, /srv/cvs contains CVS related data.
  • 12. Linux Commands • whoami Use whoami to find out who you are logged in as or who is logged into an unmanned Linux terminal • pwd Nice and simple, the pwd command prints the working directory (the current directory) from the root / directory • man The man command displays the “man pages” for a command in less . The man pages are the user manual for that command. Because man uses less to display the man pages, you can use the search capabilities of less
  • 13. Linux Commands • ls This might be the first command the majority of Linux users meet. It lists the files and folders in the directory you specify. By default, ls looks in the current directory. There are a great many options you can use with ls , and we strongly advise reviewing its the man page. Some common examples are presented here • mkdir The mkdir command allows you to create new directories in the filesystem. You must provide the name of the new directory to mkdir. If the new directory is not going to be within the current directory, you must provide the path to the new directory. To create two new directories in the current directory called “invoices” and “quotes,” use these two commands
  • 14. Linux Commands • mv The mv command allows you to move files and directories from directory to directory. It also allows you to rename files. To move a file you must tell mv where the file is and where you want it to be moved to. In this example, we’re moving a file called apache.pdf from the “~/Document/Ukulele” directory and placing it in the current directory, represented by the single . character • w The w command lists the currently logged in users.
  • 15. Linux Commands • uname You can obtain some system information regarding the Linux computer you’re working on with the uname command. Use the -a (all) option to see everything. Use the -s (kernel name) option to see the type of kernel. Use the -r (kernel release) option to see the kernel release. Use the -v (kernel version) option to see the kernel version. • less The less command allows you to view files without opening an editor. It’s faster to use, and there’s no chance of you inadvertently modifying the file. With less you can scroll forward and backward through the file using the Up and Down Arrow keys, the PgUp and PgDn keys and the Home and End keys. Press the Q key to quit from less
  • 16. Linux Commands • tail The tail command gives you a listing of the last 10 lines of a file. If you want to see fewer or more lines, use the -n (number) option. In this example, we use tail with its default of 10 lines. We then repeat the command asking for only five lines. • head The head command gives you a listing of the first 10 lines of a file. If you want to see fewer or more lines, use the -n (number) option. In this example, we use head with its default of 10 lines. We then repeat the command asking for only five lines • sudo The sudo command is required when performing actions that require root or superuser permissions, such as changing the password for another user.
  • 17. Linux Commands • history The history command lists the commands you have previously issued on the command line. You can repeat any of the commands from your history by typing an exclamation point ! and the number of the command from the history list • SSH Use the ssh command to make a connection to a remote Linux computer and log into your account. To make a connection, you must provide your user name and the IP address or domain name of the remote computer • shutdown The shutdown command lets you shut down or reboot your Linux system. Using shutdown with no parameters will shut down your computer in one minute
  • 18. Linux Commands • grep The grep utility searches for lines which contain a search pattern. When we looked at the alias command, we used grep to search through the output of another program, ps . The grep command can also search the contents of files. Here we’re searching for the word “train” in all text files in the current directory The ps command lists running processes. Using ps without any options causes it to list the processes running in the current shell ping The ping command lets you verify that you have network connectivity with another network device. It is commonly used to help troubleshoot networking issues. To use ping, provide the IP address or machine name of the other device
  • 19. Linux Commands • passwd The passwd command lets you change the password for a user. Just type passwd to change your own password. You can also change the password of another user account, but you must use sudo. You will be asked to enter the new password twice kill The kill command allows you to terminate a process from the command line. You do this by providing the process ID (PID) of the process to kill. Don’t kill processes willy-nilly. You need to have a good reason to do so. In this example, we’ll pretend the shutter program has locked up
  • 20. Linux Commands • groups The groups command tells you which groups a user is a member of • The gzip command compresses files. By default, it removes the original file and leaves you with the compressed version. To retain both the original and the compressed version, use the -k (keep) option • free The free command gives you a summary of the memory usage with your computer. It does this for both the main Random Access Memory (RAM) and swap memory. The -h (human) option is used to provide human- friendly numbers and units. Without this option, the figures are presented in bytes
  • 21. Linux Commands • finger The finger command gives you a short dump of information about a user, including the time of the user’s last login, the user’s home directory, and the user account’s full name find Use the find command to track down files that you know exist if you can’t remember where you put them. You must tell find where to start searching from and what it is looking for exit The exit command will close a terminal window, end the execution of a shell script, or log you out of an SSH remote access session
  • 22. Linux Commands • echo The echo command prints (echoes) a string of text to the terminal window • diff The diff command compares two text files and shows the differences between them. There are many options to tailor the display to your requirements • df The df command shows the size, used space, and available space on the mounted filesystems of your computer.
  • 23. Linux Commands • Two of the most useful options are the -h (human readable) and -x (exclude) options. The human-readable option displays the sizes in Mb or Gb instead of in bytes. The exclude option allows you to tell df to discount filesystems you are not interested in
  • 24. Linux Commands • curl The curl command is a tool to retrieve information and files from Uniform Resource Locators (URLs) or internet addresses. The curl command may not be provided as a standard part of your Linux distribution. Use apt-get to install this package onto your system if you’re using Ubuntu or another Debian-based distribution. On other Linux distributions, use your Linux distribution’s package management tool instead
  • 25. Linux Commands • chown The chown command allows you to change the owner and group owner of a file. Listing our example.txt file with ls -l we can see dave dave in the file description. The first of these indicates the name of the file owner, which in this case is the user dave. The second entry shows that the name of the group owner is also dave. Each user has a default group created when the user is created. That user is the only member of that group. This shows that the file is not shared with any other groups of users
  • 26. Linux Commands • chmod The chmod command sets the file permissions flags on a file or folder. The flags define who can read, write to or execute the file. When you list files with the -l (long format) option you’ll see a string of characters that look like cd The cd command changes your current directory. In other words, it moves you to a new place in the filesystem. If you are changing to a directory that is within your current directory, you can simply type cd and the name of the other directory
  • 27. Linux Commands • cat The cat command (short for “concatenate”) lists the contents of files to the terminal window. This is faster than opening the file in an editor, and there’s no chance you can accidentally alter the file. To read the contents of your .bash_log_out file, type the following command while the home directory is your current working directory, as it is by default alias The alias command lets you give your own name to a command or sequence of commands. You can then type your short name, and the shell will execute the command or sequence of commands for you