Skip to content

Instantly share code, notes, and snippets.

@junaidtk
Created August 6, 2020 07:36
Show Gist options
  • Save junaidtk/2470b2693383fd7450726c72d95454b5 to your computer and use it in GitHub Desktop.
Save junaidtk/2470b2693383fd7450726c72d95454b5 to your computer and use it in GitHub Desktop.
Basic command line code used by developer.
grep
==============
Grep search a specific patten in each file
$ grep "some string" file
Search a string in a specific.
$ grep -i "REact" file
By using -i, grep Search REact case insensitivley
$ grep -c "react" index.js
Count number of line that match strings in the file
ls
==============
List files in the directory of path, if it is file name, then it shows the information about the file
pwd
==============
Shows the fullsystem path of the current working directory
cat
==============
Used to read the content of a file.
$ echo "some text"
==============
Used to echo the line of text followed by the command.
$ touch somefile
==============
Create a file without any content.
$ mkdir some-directory
==============
Used to create a new empty directory.
$ rm someFile
==============
Remove a file from the directory.
$ rm -rf some-directory
==============
Remove a directory unconditionally doesn't consider directory has content inside or not.
$ rmdir some-directory
==============
Remove directory if there is no content inside.
$ tail somefile
==============
Read the last part of a file.
$ wget someurl
==============
$ find path -name filename
==============
find a file name inside a path specified in the command.
$ find . -name "*.js"
==============
Search smae type of file (here .js) in the path
$ mv somefile /to/some/other/path
==============
Move file from on directory to another directoty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment