0% found this document useful (0 votes)
30 views36 pages

Lecture 4 Linux Directory Structure and Basic Commands

The document provides an overview of the Linux directory structure, detailing the purpose of various directories such as /bin, /etc, and /usr. It also lists basic Linux commands, including pwd, ls, mkdir, and grep, explaining their functions for interacting with the operating system. This serves as a foundational guide for users to understand file organization and command usage in Linux.

Uploaded by

Shakeel Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views36 pages

Lecture 4 Linux Directory Structure and Basic Commands

The document provides an overview of the Linux directory structure, detailing the purpose of various directories such as /bin, /etc, and /usr. It also lists basic Linux commands, including pwd, ls, mkdir, and grep, explaining their functions for interacting with the operating system. This serves as a foundational guide for users to understand file organization and command usage in Linux.

Uploaded by

Shakeel Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36

Linux Directory Structure and Basic

Commands
Command Line Interface
• Terminal for your computer
• Enable users to interact with the operating system
• Takes in commands, and passes them on to the computer's operating system
• Output shows the reply from the operating system
Linux Directory Structure
Directory Description
/ "root" Primary hierarchy for entire file system
/bin Essential command binaries must be available in the
single-user mode for all users. e.g cat, ls
/boot boot loader files, e.g kernels, initrd

/dev device files, e.g /dev/sda

/etc Editable text configuration or Extended tool chest


Linux Directory Structure
Directory Description
/etc/opt Configuration files for add-on packages stored in /opt
Users' home directories, containing personal files,
/home personal settings etc.
/lib Essential libraries for binaries in /bin and /sbin

/media mount point for removable media such as usb

/mnt Temporarily mounted filesystems


Linux Directory Structure
Directory Description
/opt Optional application software packages

/proc Virtual fs providing process and kernel as files

/root Home directory for root user

/run runtime variable data, currently logged-in users,


running daemons etc.
/sbin Essential system binaries e.g fsck, init, route
Linux Directory Structure
Directory Description
information about devices, drivers, and some kernel
/sys features

/tmp Temporary files, not preserved between reboot,


severely size restricted
/usr secondary hierarchy for read-only user data, majority
of user utilities and applications
/usr/bin Non-essential command binaries, for all users

/usr/include Standard include files


Linux Directory Structure
Directory Description
/usr/lib libraries for binaries in /usr/bin and /usr/sbin

/usr/local Tertiary hierarchy for local data, specific to this host

/usr/sbin non-essential system binaries

/usr/share Architecture independent data

/var Variable Files


Linux Directory Structure
Directory Description
/var/lock Lock files. keeping track of resources currently in use

/var/tmp temporary files to be preserved between reboots


State information. Persistent data modified by
/var/lib programs as they run e.g databases
/var/log Log Files, Various logs

/var/run Runtime variable data


Linux Basic Commands
• pwd: present working directory.
Linux Basic Commands
• ls: list the files in a directory.
Linux Basic Commands
• mkdir: make directory.
Linux Basic Commands
• cd: to change directory, us 'cd' command
Linux Basic Commands
• touch: Update the last-modified date on the given
FILEs. commonly used for creating a new empty file.
Linux Basic Commands
• vi: screen-oriented text editor.
Linux Basic Commands
• nano: text editor.
Linux Basic Commands
• echo: display line of text/string.
Linux Basic Commands
• echo: write a line into a file using echo, write the
command as
text > filename
Linux Basic Commands
• cat: Concatenate files and print on the standard
output.
Linux Basic Commands
• cat:
⚬ replace the content of a file with another file's
content
■ (source > dest)
⚬ append the content of a file in another file
■ (source >> dest)
Linux Basic Commands
• head: output start of a file.
Linux Basic Commands
• tail: output end of a file.
Linux Basic Commands
• grep: search for a string of characters in a specified
file.
Linux Basic Commands
• rm: removes each file specified.
Linux Basic Commands
• cp: copying files and directories to another location.
Linux Basic Commands
• mv: move file or directory from one place to another.
Linux Basic Commands
• env: print a list of the current environment variables.
Linux Basic Commands
• rmdir: Remove the DIRECTORY, if it is empty.
Linux Basic Commands
• whoami: Print the current user name.
Linux Basic Commands
• find: Search for files in a directory hierarchy
Linux Basic Commands
• sleep : Delay for a specified amount of time
Linux Basic Commands
• dd : Copy a file, converting and formatting.
Linux Basic Commands
• ping: Send ICMP ECHO_REQUEST to network hosts
Linux Basic Commands
• wget: Retrieve files via HTTP or FTP
Linux Basic Commands
• hostname: Get or set hostname or DNS domain name
Linux Basic Commands
• man: interface to the on-line reference manuals

You might also like