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
[[email protected]~] # pwd
List of files and directories
[[email protected]~] # 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
[[email protected]~] # cat <options> <arguments>
// to create a file
[[email protected]~] # cat > <filename>
// to view the contents of a file
[[email protected]~] # cat <filename>
// to append or add to an existing file
[[email protected]~] # cat >> <filename>
// To combine the data of two or more files into a third file
[[email protected]~] # cat <first file> <second file> >> <third file>
// to create a zero byte file
[[email protected]~] # touch <filename>
// to create multiple zero byte files
[[email protected]~] # touch <first file> <second file> <third file>
// to change the time stamp of a file or directory
[[email protected]~] # touch <directory or filename>
// to create file using by Vi editor
[[email protected]~] # vi <filename>
Creating Directories
// to create a directory
[[email protected]~] # mkdir <directory name>
// to create multiple directories
[[email protected]~] # mkdir <first dir> <second dir> <third dir>
// to create nested directories
[[email protected]~] # mkdir -p <first dir>/<second dir>/<third dir>
Navigation of directories
// to change the directory
[[email protected]~] # cd <path of the directory>
// to change directory one level back
[[email protected]~] # cd ..
// to change directory two levels back
[[email protected]~] # cd ../..
// to change to the users home directory
[[email protected]~] # cd
Help and Command records
// to view the manual page of a command
[[email protected]~] # man <command>
// to view the commands history
[[email protected]~] # history
Copying
// to copy a file or directory
[[email protected]~] # 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
[[email protected]~] # mv <source file or directory> <destination>
// Rename a file or directory
[[email protected]~] # mv <old name> <new name>
Deleting
// to remove or delete an empty directory
[[email protected]~] # rmdir <dir name>
// to remove or delete a file or directory
[[email protected]~] # rm <options> <file or dir name>
Options
-r Recursive (Directory along with contents)
-f Forcefully
Some Other Commands
// to check date and time
[[email protected]~] # date
// to see the calendar
[[email protected]~] # cal | less or # cal | more
File Viewing commands
// to view the contents of a file screen-wise
[[email protected]~] # less <filename>
// to view the top lines of a file
[[email protected]~] # head <filename>
[[email protected]~] # head -5 <filename>
//to view the bottom lines of a file
[[email protected]~] # tail <filename> [[email protected]~] # tail -3 <filename>
File viewing Commands
//to find the location of file or directory
[[email protected]~] # find / -iname <file/dir name>
// to count the words, lines and characters of file
[[email protected]~] # 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