Linux Basic Commands | File System Hierarchy Standard | Linux Tutorials
In the post we talk about Linux Basic Commands and Linux File System Hierarchy Standard. This tutorial only for beginners. Only basics commands and stuff covered in this tutorials.
Linux File System Hierarchy Standard
/
This directory is called as the ‘root’ directory. It is at the top of the file system structure. All other directories are placed under it.
/root
The default home directory of the root. In Linux Unix the administrator is called as Root.
/home
It contains the home directory of all users (similar to ‘documents and settings’ folder in Windows). When any user logs in the current working directory by default is the user’s home directory.
/boot
It contains the kernel, which is the core of the operating system. it also contains the files related for booting the OS such as the boot loader.
/sbin
sbin stands for system binary. It contains essential system commands which can only be used by the superuser (root). Example – fdisk, dump etc.
/bin
bin stands for binary. It contains essential commands which are used by all users. Example – ping, cat, chmodetc.
/usr
usr stands for UNIX system resources. It contains the programs and applications which are available for users (smililar to program files in Windows)
/var
var stands for variable. It contains variable information, such as lags and print queues.
/dev
dev stands for device. It contains information about all hardware devices.
/etc
etc etc stands for et cetera. It contains all configuration files.
/opt
opt stands for optional. It generally contains the third party software. example – open office etc.
/media
It is the default mount point for removable storage media such as cdrom/dvd and pendrives etc.
Linux Basic Commands
Print Working directory
[root@pc~] # pwd
List of files and directories
[root@pc~] # ls <options> <arguments>
options
-l Long list including attributes
-a All files and directories including hidden
-d for a particular file or directory
-R recursive to see the tree structure
-i Inodes list
Creation of Flies
Users can create files in linux by using these commands:
- cat command
- touch command
- vi editor
[root@pc~] # cat <options> <arguments>
// to create a file
[root@pc~] # cat > <filename>
// to view the contents of a file
[root@pc~] # cat <filename>
// to append or add to an existing file
[root@pc~] # cat >> <filename>
// To combine the data of two or more files into a third file
[root@pc~] # cat <first file> <second file> >> <third file>
// to create a zero byte file
[root@pc~] # touch <filename>
// to create multiple zero byte files
[root@pc~] # touch <first file> <second file> <third file>
// to change the time stamp of a file or directory
[root@pc~] # touch <directory or filename>
// to create file using by Vi editor
[root@pc~] # vi <filename>
Creating Directories
// to create a directory
[root@pc~] # mkdir <directory name>
// to create multiple directories
[root@pc~] # mkdir <first dir> <second dir> <third dir>
// to create nested directories
[root@pc~] # mkdir -p <first dir>/<second dir>/<third dir>
Navigation of directories
// to change the directory
[root@pc~] # cd <path of the directory>
// to change directory one level back
[root@pc~] # cd ..
// to change directory two levels back
[root@pc~] # cd ../..
// to change to the users home directory
[root@pc~] # cd
Help and Command records
// to view the manual page of a command
[root@pc~] # man <command>
// to view the commands history
[root@pc~] # history
Copying
// to copy a file or directory
[root@pc~] # cp <options> <source file> <destination>
Options
-r Recursive (to copy the directory along with its contents)
-v verbose
-p copy with permissions
Moving and renaming
// to move a file or directory to a different location
[root@pc~] # mv <source file or directory> <destination>
// Rename a file or directory
[root@pc~] # mv <old name> <new name>
Deleting
// to remove or delete an empty directory
[root@pc~] # rmdir <dir name>
// to remove or delete a file or directory
[root@pc~] # rm <options> <file or dir name>
Options
-r Recursive (Directory along with contents)
-f Forcefully
Some Other Commands
// to check date and time
[root@pc~] # date
// to see the calendar
[root@pc~] # cal | less or # cal | more
File Viewing commands
// to view the contents of a file screen-wise
[root@pc~] # less <filename>
// to view the top lines of a file
[root@pc~] # head <filename>
[root@pc~] # head -5 <filename>
//to view the bottom lines of a file
[root@pc~] # tail <filename> [root@pc~] # tail -3 <filename>
File viewing Commands
//to find the location of file or directory
[root@pc~] # find / -iname <file/dir name>
// to count the words, lines and characters of file
[root@pc~] # wc install.log
You may like also:
- How To Install Django on Ubuntu
- How To Install VerneMQ on UbunTu, RHEL, Docker, Debian and Cent OS
- How to Install PyCharm on Ubuntu
- How to Install InfluxDB on Ubuntu
- How to Install Flask on Ubuntu
- How to install MongoDB in ubuntu
- How To Install Node.js on Ubuntu
Buy now : Raspberry PI 3 Model B+ Motherboard
I hope you like this post “Linux File System and Basic Commands”.Do you have any questions? Leave a comment down below!
Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.
Pingback: Linux Basic Commands | File System Hierarchy Standard | Linux Tutorials — IoTbyHVM – Explore TechBytes – hashstacks
Pingback: Linux File system & Basic commands - onionlinux.com
Pingback: Linux File System hierarchy & Commands — APalgorithm.com
Pingback: Transform Your Raspberry Pi into a Smart Assistant with Alexa - IoTbyHVM