Posts

Basic Commands in Linux - WATCH

Image
watch    watch command is used to see the output of particular command frequently and displays the output. Consider you want to see whether a file in a particular folder was Processed or not. To check this we frequently use ls command or find command to check the file. Instead, we can use watch command for these scenarios watch ls -l - this will run the ls -l command for every 2 seconds and display the output like below. if you want to change the time interval we can use watch -n (sec) command. for example: watch -n 3 ls -l this will run the command for every 3 sec to go back to terminal use ctrl+c.

Basic Commands in Linux - To change the current directory

cd     cd is used to change the working directory. cd // - this will take you to root directory cd .. - this will take you to the parent directory cd folder1 - this will take you folder1 directory cd folder/folder2 - this will take you to the folder2 directory

Basic Commands in Linux - To delete file and folder

rm    rm command is used to remove the files.  rm filename - this will remove the file. rm oel rm -i filename - this will prompt before removal. rm -i owl      rm: remove regular empty file 'owl'?    rm -d folder1 - this will remove the empty folder. rm -d folder rm -r folder - this will remove the folder with its subdirectories. rm -r folder rmdir       rmdir folder - this will r emove the empty directory. rmdir  folder rimdir -p folder/folder1/folder2 - this will remove the folder with its subdirectories. rm -p folder/folder1/folder2

Basic Commands in Linux - To create folder or directory

mkdir    mkdir used to create a folder or directory. mkdir [OPTION]... DIRECTORY.. .   mkdir bill - this will create a folder called bill in current directory mkdir bill mkdir john smith - this will create two directory john and smith at same time. mkdir john smith  mkdir -p never/give/up - this will create never as parent directory which contains give and give contains up. mkdir -p never/give/up

Basic Commands in Linux - To display list of files and folders in a directory or folder

ls    ls is used to display the list of files in current folder. here you can see only few option . To know more options please comment below. ls - list of files in current folder. ls  ls -a - this will list all the files including hidden one. hidden files will start with . (.filename.txt) . ls -a ls -l - this will display size,access,owner,date modified details of files or folders ls -lrt

Basic Commands in Linux - To create a file

Touch     Touch is used to create an empty file, Touch can also be used to change the date and time of the file. touch [filename]  - This will create an empty file. touch bill touch -t mmddhhmm [filename] - this command will change the date and time of the file. touch -t 10101213 bill

Basic Commands in Linux - To display current directory or folder

PWD     This command will show you the current directory in which you are working. pwd - this command will display output as below, showing your current directory or folder. /home/jaravis/files