Monday, August 5, 2019

Unix Interview Questions

* Command to get Header in unix 
'Head' is used to get header in a file

* Command to check the status of your job 
'Jobs' Command

* Command to stop current task 
'Ctrl+z' Command 

* Command to get current task to back ground
'Bg Jobname' Command

* Command to bring back ground process to fore ground
'Fg Jobname' Command

* Command used to search a string in a file
'Grep' is the command used to search a string in a file.

* SED, AUK command in unix ?

* Have you worked on shell script ?

* Unix command used to save 
Ctrl+D is the command used to save file

* Unix command to clear screen
Ctrl+L command is used to clear screen

* Unix command to display unique line
uniq myfile.txt

* Unix command to display duplicates
uniq -D filename is used to display on duplicates

* 'Touch filename' command result if file already exist
When you run touch on an already existing file, the file's access and modification timestamps are updated to the current time. 

* How to display hidden files
Ls -a

* Command used to kill the running task
Kill or Kill -9

* How to find PID of the process 
PID means process id, unique number of the process. 
PS -EF is used to find pid of the process.

* Command used to transfer files from one server to another server  
FTP command is used

* Command used to know how long server is running
UPTIME command is used

* How do you truncate a file in unix ?
truncate -s 0 filename is used to truncate a file. Here -s means size, 0 is the value of the file to be set. 

* Which unix command is used to enter text at the end of the file?
$ echo "Hello World" >> file.txt 
$ cat file.txt
This is the first line. 
Hello World


* IF FILE IN UNIX CAN'T OPEN, BECAUSE OF NO PERMISSION. HOW TO  RECTIFY IT ?
 

* IF FILE IN UNIX CAN'T OPEN BECAUSE ITS A BIG FILE. HOW TO RECTIFY IT ?
 


Date Functions in SQL

Select Getdate() as CurrentDate; Select Getdate() -1 PreviousDate; Select Getdate() +1 NextDate; Select DATEADD(dd,1,getdate()) as NextDate;...