An Introduction to Linux File and Directory

June 19, 2015 | Views: 6701

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here


LINUX is a Unix-like and mostly POSIX-compliant computer operating system assembled under the model of free and open-source software development and distribution. The defining component of Linux is the Linux kernel, an operating system kernel first released on 5 October 1991 by Linus Torvalds.

The Free Software Foundation uses the name GNU/Linux to describe the operating system. Linux is the first truly free Unix-like operating system. The underlying GNU Project was launched in 1983 by Richard Stallman. It began originally to develop a Unix-compatible operating system called GNU, intended to be entirely free software.

Many programs and utilities were contributed by developers around the world and, by 1991, most of the components of the system were ready. Yet, still missing was the kernel, which is called Linux, was combined afterwards with the GNU system to produce a complete free operating system. Linux Kernel was bundled with many softwares from various distributors and it gave rise to many flavors of LINUX.


Features Of Linux OS:

1. Open Source- Free

2. Multitasking

3. Multi-User

4. Portable

5. Reliability

6. Scalability

7. Networking & Security


File Directory

/ This directory is called superuser home directory. It’s at the top of file system structure. All other directories are mounted under it.

/boot This directory contains the kernal image file. It also contains the files related to booting the system such as bootloader.

/etc This contains the whole system configuration file.

/home This is the all users home directory.

/mnt This is a generic mount point under which you mount your filesystems such as cdrom, floppy.

/proc This is not a real file system, but a virtual file system. This directory is empty until the proc file system is mounted.

/sys Modern Linux distributions include a /sys directory as a virtual filesystem (sysfs, comparable to /proc, which is a procfs). It stores and allows modification of the devices connected to the system.

/dev This directory contains the devices nodes through which the operating system can access hardware and software devices on the system.

/bin This directory contains the command used by superusers and normal users.

/sbin This directory contains the command used by superusers only.

/lib This contains the library required for running the additional applications and running the Linux kernel. It also contains the library essential for binaries in /bin and /sbin.


Basic Commands

root@haktuts:~$ pwd
[pwd will show the present working directory]

root@haktuts:~$ ls
[ls will show the list of files and directories of present working directory]

root@haktuts:~$ ls b*
[ls b* will show the list of files and directories starting with b and ending with anything]

root@haktuts:~$ ls -l
[listing of all files and directories along with attributes (i.e. more detailed formats like file permission, file size etc.]

root@haktuts:~$ ls -a
[listing of all files and directories, along with hidden files or files starting with periods (i.e. file stating with * like *bashrc]

root@haktuts:~$ ls -R
[shows the listing of file and directory in tree structure]

root@haktuts:~$ cat Haktuts.txt
[users can use the command cat to see the preview of Haktuts.txt file]

root@haktuts:~$ cat > Hak.txt
[used to create files]

root@haktuts:~$ cat Haktuts.txt Hak.txt >>new.txt
[transfer the content of Haktuts.txt and Hak.txt to new.txt file]

root@haktuts:~$ cd
[to change the directory]

root@haktuts:~$ cd com
[go to directory name com]

root@haktuts:~$ cd ..
[change the directory one level back]

root@haktuts:~$ cd ../..
[change the directory two levels back]

root@haktuts:~$ cd ~
[change the directory to home directory]

root@haktuts:~$ Vi
[will create a blank file]

root@haktuts:~$ Vi
[will create multiple files at once]

root@haktuts:~$ Vi file1.txt
[to open file1.txt using Vi] [i- to insert text in file1.txt] [press Shift+: and then type wq to save and quit
: q to exit without any changes in file
: x to save changes and exit]

root@haktuts:~$ mkdir com
[will create a directory name com]

root@haktuts:~$ mkdir com lap mob
[create multiple directories]

root@haktuts:~$ mkdir -p com/lap/mob
[reate a directory with their subdirectories]

root@haktuts:~$ cd –
[go to last working directory] [eg:currently user in /home/Haktuts/Desktop directory and user last working directory is /root/Desktop. when a user types cd – the user goes directly to /root/Desktop directory]

root@haktuts:~$ rm Haktuts.txt
[rm remove the file Haktuts.txt]

root@haktuts:~$ rmdir com
[rmdir removes the directory name called com – only if the com directory is empty]

root@haktuts:~$ rm -rf com
[rm -rf remove the directory and also the content/data available in the directory]

root@haktuts:~$ cp Hak.txt /root/Desktop
[copy the file Hak.txt to /root/Desktop Directory]

root@haktuts:~$ cp -r com /root/Desktop
[copy the directory com to /root/Desktop directory]

root@haktuts:~$ mv Haktuts.txt /home
[move the file Haktuts.txt to /home directory]

root@haktuts:~$ mv Hak.txt Hak2.txt
[rename the file Hak.txt to Hak2.txt]


You might also like:

1.Installation of Linux

2.System Management

3.Network Management

4.Server Management


Share with Friends
Use Cybytes and
Tip the Author!
Share with Friends
Ready to share your knowledge and expertise?
  1. This is a great resource, thank you!

  2. Wow we hve reach the limit of every humans will start thinking like a computer

Page 5 of 5«12345
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play

Support Cybrary

Donate Here to Get This Month's Donor Badge

Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?