Ready to Start Your Career?

An Introduction to Linux File and Directory

HakTuts 's profile image

By: HakTuts

June 19, 2015

An Introduction to Linux File and Directory - CybraryIntroductionLINUX 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- Free2. Multitasking3. Multi-User4. Portable5. Reliability6. Scalability7. 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 Commandsroot@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 Linux2.System Management3.Network Management4.Server Management5.Security
Schedule Demo