Git Product home page Git Product logo

cmd-challenge-solutions's Introduction

CMD-Challenge-Solutions

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/

Challenges and Solutions

Question 1 - Print "hello world".

Command: echo

Description: Echo the STRING(s) to standard output.

echo "hello world" 

Question 2 - Print the current working directory.

Command: pwd

Description: Print the full filename of the current working directory.

pwd

Question 3 - List names of all the files in the current directory.

Command: ls

Description: List information about the FILEs (the current directory by default)

ls 

Question 4 - There is a file named "access.log" in the current directory. Print the contents.

Command: cat

Description: Concatenate FILE(s), or standard input, to standard output.

cat

Question 5 - Print the last 5 lines of "access.log".

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:

Description:

grep -l 500 *

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.