Linux basic commands
Linux basic commands :
$ who am I –>To see from which user you have logged in
$ who –>To see all who is logged in yet this point of time from which IP
$ w –>More details about user related info
$ date –> To display the date of the system
$ cal –> To display the current month calendar
$ time –> Calculate response time of the activity / command
$ hwclock –> To see detailed date and time with time zone
$ ls -l –> List files,directories with properties
$ ls –> List files and directories
$ ls –a –> List all hidden files and directories
$ ls –d –> To list only directories
$ pwd –> Print working directory
$ cd <Path of the directory> –> Change directory
$ clear –> To clear the screen
$ uptime –>To see the server up time, boot time, users and load
$ uname –a –> To verify Operating system version, kernel version and architecture
$ touch <File Name> –>Create an empty file / Multiple empty files yet a time
$ touch –am –> It will change a file time to current time
$ touch –r file1 –B 30 file2 –>it will create two files with 30 seconds time difference
$ cat /dev/null > file –>To empty the data file
$ cat > <File Name> –>Create an single file with text
$ rm –rf <File / Directory Name> –> Delete files/directories forcefully
$rmdir <directory> –>Delete directories only
$ mkdir <Directory Name> –>Create an empty directory / directories
$ mkdir –p <directory/directory/directory> –>To create parent directories
$ cat <File Name> –> View content of file
$ cp <Source path> <Destination path> –> Copy the files from one path to another path
$ cp –Rv <source> <destination> –> copy directories from source to destination
Options:
-R, -r, #copy directories recursively
-v #verbose to see progress of copy job
-p #preserve
-f #forcefully
-I #interactive: Ask before overwriting file
$ mv <source> <destination> –> Move files/directories
$ mv <old name> <new name> –> Rename the file and directory
$ last –> Check who logged in and when logged in duration
$ arch –> To know architecture
$ reboot / init 6 –> Restart server
$ poweroff / init 0 –> To shut down the server
$ dmesg –> Check boot process logs
$ nsloookup <Server Address> –> check dns resolution
$ dig <server address> –> check dns resolution to debug
$ tree <directory> –> It will show the tree of parent directory
$ stat <file name> –> detailed information about file
$ wc –> word count, character count and line count
Options:
-l #Check line count
-c #Character Count
-w #Word Count
Help relate commands:
$ whatis <Command Name> –> It will display single line description about command
$ whereis <Command Name> –> It will provide you path of the command
$ man <command> –> manual page of the command
$ info <command> –> Information about the command
$ <command> –help –> It will gives a command options and there usage
$ apropos <keyword> –> To know about the command use
NOTE: All commands must be small case letters
