Linux Basic Commands
Introduction:
The computer programs that allocate the system resources and coordinate all the details of the computer's internals is called the operating system or the kernel.
Users communicate with the kernel through a program known as the shell. The shell is a command line interpreter; it translates commands entered by the user and converts them into a language that is understood by the kernel.
To Work with Linux we need to be familiar with some of it's basic commands.
In this post we will learn some basic commands with flags and usage.
1. pwd command
pwd command is used to check the current working directory. By entering simply pwd in your linux terminal will return the full absolute path of current directory.
The pwd command uses the following the syntax:
pwd [options]
sample response:
root@firstvm:/opt/myapplication# pwd
/opt/myapplication
2. ls command
ls command is used to list files inside a directory.
ls will list only file names, if you want to get more information related to files like file creation date, time and what are the permissions associated to this file and size like all information, we can do a long list of files using 'ls -l' command.
ls command have some more flags which will be very useful. Like
ls -l : to long list the files and the files will be sorted in alphabetic order of file names.
ls -lt : to long list the files and the files are sorted ascending order of time when they modified.
ls -lrt : to long list the files and sort them in reverse order of time when they modified.
ls -lrth : to long list the files and sort them in reverse order of time when they modified and the files size will be in human readable format.
ls -1 (number '1') : to only file names one by one.
ls -lS : to list all files depending on their size.( Size in descending order)
Sample examples:
root@firstvm:/# ls
bin boot dev etc home lib lib32 lib64 libx32 lost+found media mnt opt proc root run sbin snap srv sys tmp usr var
lroot@firstvm:/# ls -lrth
total 72K
lrwxrwxrwx 1 root root 8 Mar 2 21:39 sbin -> usr/sbin
lrwxrwxrwx 1 root root 7 Mar 2 21:39 lib -> usr/lib
drwxr-xr-x 3 root root 4.0K Mar 9 08:00 mnt
drwxr-xr-x 4 root root 4.0K Mar 9 14:58 opt
Comments
Post a Comment