Write a command line that uses only ls and grep to list all files in your current directory whose names consist of three letters (lowercase or uppercase) followed by an arbitrary number of digits (zero digits is possible)
ls -l | grep -i ( [a-z]{3}[0-9]* )
ls -l lists all files in your current directory.
-i used in grep command ignores case.
[a-z]{3} gives three letters
[0-9]* contains zero or any number of digits.
Write a command line that uses only ls and grep to list all files in your...
1.Write a find command that will display the inode number of all files in the working directory (only) that contain the string "#include". 2.Write an ls command with a glob specification that will list the names of all files in the working directory that are exactly 10 characters long, begin with w, x, y, or z, and do not contain a "." character (i.e. no file extension). 3.Write an ls command with a glob specification that will list the names...
a) How would you use the ls command to display all of the files/directories in the directory ‘/sbin’ that start with ‘bl’? b) How would you use the ls command to display all of the files/directories in your current directory that contain the word ‘grade’ somewhere in the name and end with ‘.pdf’? c) How would you use the ls command to display all of the files/directories in your current directory that are any two characters followed by the file...
10 pts) Write a single-line shell command that outputs the words in /usr/share/dict/words that begin with an uppercase A or an uppercase E, followed by any two characters, followed by a lowercase b, and ending with a lowercase a or a lowercase n Note that words greater than five characters in length are valid (i.e., there may be zero or more characters in between the lowercase b and the final lowercase a or lowercase n)! The command should append the...
Write a C program countFiles.c to be executed on the command line as follows: countFiles <directory> The program should count the (regular) files in the specified directory as well as all subdirectories and output the total number on the console. Files and subdirectories whose names .start with should be ignored! To do this, define a function int countFilesRec(char* dirName)that dirName returns the number of (regular) files in the directory and all the subdirectories. Call the function recursively to count the...
e. Write a command to search all the files in your parent directory whose name is starting from a number in between 9 to 10. (0.75)
QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A. List all files and directories recursively starting from / B. List a file names * in / C. List all files in / directory D. List all files and directories in / directory QUESTION 2 Which command is used to extract a column/field from a text file / input. A. paste B. get C. cut D. tar QUESTION 3 Which command creates an empty...
1) Write a single line UNIX command to list all sh files matching the multiple conditions below: • at directory "/home/test" • filename containing "exam" 2) Write a single line UNIX command to check if "/home/exam2" in the PATH variable. 3) How to obtain the value of command line arguments in a shell program? 4) Write a single line UNIX command to run an executable Java program Hello at background and output the number of lines in the result. 5)...
How do I write a bash script that uses the 'egrep' command to list files containing either 'a' followed by 'g' or 'g' followed by 'a' (possibly with characters in between)?
Linux commands questions help 1.Find all files under the current directory which ends in '.dat' (just the .dat not the single quotes as well) and use -exec to create a listing of each file's inode number. 2. Find all files under the /tmp directory whose size is greater than 65 kilobytes and use -exec with an appropriate command to delete these files. 3. Search files in ~ and all subdirectories -- that contain the word 'hawk' (case sensitive) at the...
write the bash script Write a script compress_large_files.sh. This script accepts one or more command line arguments. The first argument has to be an integer; let’s call it size. If this is the only command line argument, compress_large_files.sh inspects all files in the current working directory and compresses every file of size at least size. If there is more than one command line argument, all arguments except the first one must be valid directories. In this case, compress_large_files.sh inspects the...