A directory named \'classDir\' contains lot of text files. Show the command(s) t
ID: 3685803 • Letter: A
Question
A directory named 'classDir' contains lot of text files. Show the command(s) to find a string 'hundred' inside this 'classDir' directory case-insensitive manner. The output should be written to the stdout and also to a file named '/home/user/found.txt'. Write a command to find all the files which are older than 30 days and move them to bkup directory. In Linux how to put a job to background? How to check the number of processes running in background? How to bring the background job from background to foreground?Explanation / Answer
1. find a string in any particuler directory
grep -lR 'your-string' /
"i" :- use for ignore case
"R" :- use for recursive.
"l" :- use for show the file name
"/" :- use for root directory use replace with your directory in with directory you find any string
2. command to find all the files which are older than 30 days and move them to another directory?
find /sourcedirectory -maxdepth 1 -mtime +30 -type f -exec mv "{}" /destination/directory/ ;
"find" :- use for find files
"/sourcedirectory" :- use for in witch directory you want find
"-mtime +30" :- use for last 30 day. you also change according to your day
"mv" : move file in another directory
"/destination/directory/" use for where you want move files
3. Linux how to put a job to background?
"bg" :- use for run it in the background any command
4. move job in fornt end ?
"fg" :- use for move background to foreground any command
5. How to check the number of processes running in background?
"ps" :- use for get processes running in background
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.