15 Linux commands every programmer should know

A thread🧵
🔸pwd -
To print the present working directory

The command will return an absolute (full) path, which is basically a path of all the directories that starts with a forward slash (/).

An example of an absolute path is /home/username
🔸cd -
To change to a different directory

Example: cd workspace

There are some shortcuts to help you navigate quickly:
-> cd .. to move one directory up
-> cd to go straight to the home folder
-> cd- to move to your previous directory
🔸ls -
To list the contents of a directory

Variations with the ls command:
-> ls -R will list all the files in the sub-directories too
-> ls -a will show the hidden files
-> ls -al will list the files and directories with detailed information like the permissions,size,owner,etc
🔸mkdir -
To make a new directory

Example: mkdir abc

-> To generate a new directory inside another directory, use this command mkdir abc/def
🔸rmdir -
To remove an empty directory

Example: rmdir abc

Note if the directory contains files or subdirectories, it does not remove the directory.
🔸touch -
To add files

Example: touch abc/pqr.txt
This creates a new txt file named pqr inside abc
🔸cat -
To print out contents of a file

Example: cat abc/pqr.txt

Other ways to use the cat command:
-> cat > filename creates a new file
-> cat filename1 filename2>filename3 joins two files (1 and 2) and stores the output of them in a new file (3)
🔸tree -
To print out the layout of files and directories under it in a tree fashion
🔸cp -
To copy the file from the current directory to a different directory

Example: cp pqr.txt /home/username/MyFiles
It would create a copy of pqr.txt from your current directory into the MyFiles directory
🔸rm -
To remove a file

Example: rm abc/pqr.txt
It would remove the pqr.txt file
🔸mv -
To move files, can also be used to rename files. Arguments are similar as in the cp command

To rename files, the Linux command is:
mv oldname.ext newname.ext
🔸echo -
To move some data into a file

Example: echo Hello world >> pqr.txt
It will add the text "Hello world" into the file pqr.txt
🔸ping -
To check connectivity status to a server

Example: ping google.com
It will check whether you’re able to connect to Google and also measure the response time
🔸grep -
It lets you filter/search through all the text in a given file

Its usage is: grep <pattern> <file>
🔸head -
To view some lines of a file from start
Its different usages are :
-> head filename: To view first 10 lines of the file
-> head -n number filename: Number of lines required
-> head -c bytes filename: Number of bytes required

Similar is the tail command to view from end
If you liked this, make sure to:

1. Follow me @meetjain74

2. Retweet the first tweet

3. Turn on the notifications to never miss these amazing tweets.

Thanks so much for getting to the end of the thread! Let me know your thoughts below

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Meet Jain🦅

Meet Jain🦅 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @meetjain74

1 Nov
What is an IP address and a MAC address?

A thread 🧵
🔸IP address -
IP stands for Internet Protocol Address. It is a numerical label assigned to each device connected to a computer network that uses Internet Protocol for communication.
The internet needs a way to differentiate between different computers, routers, and websites. IP addresses provide a way of doing so and form an essential part of how the internet works.
Read 15 tweets
31 Oct
Git keywords every programmer should know

A thread 🧵
🔸Repository
A repository is like a folder for your project. It contains the collection of the file as well as the history of the changes made to those files. Sometimes Github users shorten this as 'repo'
🔸Branch
A branch is a parallel version of a repository. It is contained within the repository but does not affect the primary or master branch allowing you to work freely without disrupting the 'live' version.
Read 18 tweets
30 Oct
What is JSON?

A thread 🧵
🔸JSON stands for JavaScript Object Notation.
🔸JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute-value pairs and arrays.
🔸JSON is a language-independent data format. It was derived from Javascript, but many modern programming languages include code to generate and parse JSON-format data.
Read 10 tweets
29 Oct
Public APIs for your projects

A thread 🧵
🔸Open Weather Map
Free API to get weather information all over the world
openweathermap.org/api
🔸Skyscanner search
API to get real-time information about planes traveling across the world
skyscanner.github.io/slate/#api-doc…
Read 10 tweets
28 Oct
Best Youtube channels to learn coding

A thread 🧵
🔸freeCodeCamp.org
It has tutorials for every programming language and also has complete data structures and algorithms course
youtube.com/c/Freecodecamp
🔸Programming with Mosh
Known for python, javascript and csharp tutorials
youtube.com/c/programmingw…
Read 11 tweets
27 Oct
i++ vs ++i
Pre increment vs post increment

A thread 🧵
You have definitely used i++ to increment your loop variable inside a loop.

But what does this statement mean? We can also use ++i or i=i+1 to accomplish the same task.
🔸Pre-increment (++i)
Before assigning the value to the variable, the value is incremented by one.
Ex -
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(