This repository is for the for all the solutions and read-ups for the command line challenge. Since the challenges are one liners so with the solutions the following info on the command will be updated.
Link to the challenge: https://cmdchallenge.com/
Command: echo
Description: Echo the STRING(s) to standard output.
echo "hello world"
Command: pwd
Description: Print the full filename of the current working directory.
pwd
Command: ls
Description: List information about the FILEs (the current directory by default)
ls
Command: cat
Description: Concatenate FILE(s), or standard input, to standard output.
cat
Command: tail
Description: Print the last 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read standard input.
tail -5 access.log
Question 6 - There is a file named "access.log" in the current working directory. Print all lines in this file that contains the string "GET".
Command: grep
Description: grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.
grep "GET" access.log
Question 7 - Print all files in the current directory,one per line (not the path, just the filename) that contain the string "500".
Command: grep
Description: grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.
grep -l 500 *
Question 8 - Print the relative file paths, one path per line for all filenames that start with "access.log" in the current directory.
Command: ls
Description: List information about the FILEs (the current directory by default)
ls access.log*