Sunday, August 30, 2020

Linux Command Line Hackery Series: Part 1




In this concise article we will learn some basics of how to use Linux Command line, so lets get started.

Requirements:

1. An open Terminal in your Linux Box. I'm using Kali Linux 2.0
or you can check out this amazing website Webminal

Command:  ls
Syntax:         ls [flag(s)]
Function:      ls is short for list. ls command is used to list the contents of a directory these contents include files, folders, and links. ls has many optional flags as well, some of them are described below
Flags:    -a this flag is used to view hidden files that is those files whose names are preceded                      by a '.'(dot)
               -l  this flag is used to view file permissions, owner of the file, group of the owner, the                        file size, the modification date, and the filename. We'll talk more about it in later                            articles.

Command:  mkdir
Syntax:         mkdir dirname
Function:      mkdir is used to create a directory (or a folder) with the name which is followed by the command

now lets create a directory in our current directory named as myfiles, how would you do that?

mkdir myfiles

which command should we use in order to verify that the directory has been created in our current folder?

ls

this will list all the files and directories in our current folder. Do you see myfiles directory listed?

Command:  cd
Syntax:         cd path/to/directory
Function:      cd is short for change directory. It is used to navigate directories, or to make it clear it does the same thing as what double clicking on a folder do except it doesn't show you contents of the directory :(. In order to navigate or visit another directory we need to provide it's ABSOLUTE-PATH or RELATIVE-PATH you heard that, didn't ya?

Paths are of two types relative path or absolute path (also called full-path). Relative as the name suggests is relative to the current directory, so if you have to navigate to a folder within the current directory you'll just simply type cd directory_name. But what if you have to navigate to a directory which is the parent of current directory? Well it's easy just type cd .. (yes double dots, you noticed that .. and . thing when you typed ls -a, didn't you?). The double dots mean the directory above current directory (i,e the parent directory) and a single dot means the current directory (i,e the directory that I'm currently in). Now if you have to navigate two directories above current directory using relative path navigation you'll type

cd ../.. 

here .. means previous directory and another .. after slash (/) means the previous directory of the previous directory sounds confusing..!

The Absolute Path means full path to the file or folder which starts from root directory. Say I want to navigate to my home folder using absolute path, then I'll type:

cd /home/user

where user is the username
Now think of navigating to the myfiles folder from your home directory using the absolute path, it will be something like this:

cd /home/user/myfiles

Exercise: Create a directory project1 inside your home directory and inside the project1 directory create a file and a directory named index.html and css respectively. Then navigate to the css directory and create a style.css file inside it. At last navigate out of the css directory to home both using the relative and absolute path mechanisms.

[Trick: To get quickly out of any directory to your home directory type cd ~ [press Enter] or simply cd [press Enter]]

Command:  touch
Syntax:         touch filename
Function:      touch is a nifty little function used to create an empty file (actually it's used to change access time of a file but everyone has got bad habits :P ). You can create any type of empty file with the touch command. If you are a bit curious about touch read the manual page of the touch command using the man touch command.

Now lets create a few files inside of our myfiles directory

touch file1 file2 file3

The above command creates three empty files in our current directory named file1, file2, and file3.
How will you verify that it has indeed created these three files in your current directory? I won't answer this time.

Command:  echo
Syntax:         echo Hacker manufacturing under process
Function:      echo is used to display a line of text. By default echo displays a line of text on the terminal which is the standard output device (stdout for short). However we can redirect the output of an echo command to a file using > (the greater than symbol).
Now if we have to echo a line of text to a file, say file1 in our myfiles directory, we will type:

echo This is file1 > file1

The above command will echo the text "This is file1" to file1.

Command:  cat
Syntax:         cat filename [anotherfilename...]
Function:      cat stands for concatenate (not that puny little creature in your house). The main function of cat is to concatenate files and display them on your terminal (or in geeky terms stdout). But its also used to display the contents of a file on your terminal.

Let's display the contents of file1 in the myfiles directory that we echoed to it using the echo command, for that we'll type:

cat file1

Awesome I can see on black screen contents of my file (what if your terminals background is white?), looks like I'm becoming a hacker. In case you don't see it then I suggest you should give up the thought of becoming a hacker. Just kidding you might have missed a step or two from the above steps that we performed.

Now lets say that we want to add another line of text to our file using the echo command should we use the same greater than (>) symbol? No, if we want to add another line (which in geeky terms is to append a line) to our file using the echo command we have to use >> (two greater than symbols) like this:

echo Another line of text >> file1

now to check the contents of file1 we'll type:

cat file1

OK we wrote two lines inside of the file1.
Does it mean we have to add three greater than symbols to write third line? Oh! I didn't thought you'd be such a genius.

A single greater than symbol (>) means redirect the output of the preceding command to a file specified after the > symbol. If the file exists then overwrite everything that's in it with the new contents and if the file does not exist then create one and write to it the output of the preceding command. So if you had typed

echo Another line of text > file1

it would have overwritten the contents of the file1 with "Another line of text" and the line "This is file1" would no longer be present in the file.

Two greater than symbols (>>) mean that append (remember the geeky term?) the output of the previous command to the end of file specified after >>. Now if you want to add another line of text to file1, you won't use >>> rather you'll use >> like this:

echo Third line in file1 >> file1

This is it for today. But don't worry we'll learn more things soon.

Related links


36 comments:

  1. It is safe to say that you are anticipating getting in shape? In the event that truly, at that point you can Buy Phentermine 37.5mg Online USA. The specialist will endorse Buy Phentermine Online to get in shape. The medication can be ordered legitimately for the decrease of weight. It has been demonstrated that Phentermine is very powerful to get in shape. Increment learning and decrease tension.

    ReplyDelete
  2. Ambien is known for generating missing chemicals in the brain. Order Ambien Online However, doctors would recommend to take therapy and other forms of activities to control the stress but the tablet will help in getting instant results. The chemical balance in the brain is very important and the tablet will help in maintaining the desired balance by generating the chemicals.

    ReplyDelete
  3. Ultram is that the mechanical name of the moral medication alluded to as Buy Tramadol Online. Get Tramadol torment pills, tramadol is partner narcotic like torment drug, suggesting that it takes a shot at your body related cerebrum inside the comparative way as a narcotic and it's an agony reliever.

    ReplyDelete
  4. Buy Phentermine Online without Prescription is a medication which is devoured to lessen weight. This is a top of the line and useful medication. There are numerous meds accessible in the market to decrease weight or weight. Weight addition and corpulence are discovered to be a critical issue in the present time.

    ReplyDelete
  5. Buy Phentermine Online without Prescription is a medication which is devoured to decrease weight. This is a top of the line and gainful medication. There are numerous meds accessible in the market to diminish heftiness or weight. Weight addition and corpulence are discovered to be a critical issue in the present time. Ladies are the essential victims of the equivalent since they need to go through different physical and mental strains during their lifetime.

    ReplyDelete
  6. You must consult your doctor if you have an allergic reaction such as skin rashes, burning in eyes, skin, sore throat and fever. Certain side effects are slow rate of breathing, nausea, loss of appetite, dizziness, missed menstrual periods and much more. You can Buy Tramadol without prescription.

    ReplyDelete
  7. Alterations in weight are the toughest part of the life of the person. Buy Phentermine Online The weight gain and loss are very tough and it requires a lot of discipline. So, the person will have to follow a proper regime to get the desired results. However, it can take months or years to get the desired results.

    ReplyDelete
  8. Sleep deprivation has become a common problem in the life of many people. Buy Ambien Online The main reason for this deprivation is the daily life and hectic routine. The increase in the demand of luxury has given rise to various problems in the life of the person.

    ReplyDelete
  9. They will have to not only have to find a suitable position but will also have to sustain their current position. Buy Ambien Online So, these things are possible only when they work hard and very hard work leads to mental tension and stress. The mental tension takes away their sleep and they suffer from insomnia. They will have to buy Ambien online cheap to get rid of the problems relates to sleepless nights.

    ReplyDelete
  10. Thus, the best way will be to take help from medication to boost the results. So, you can Order phentermine 37.5mg online from the site to get the best weight loss results. The tablet helps in losing weight and staying fit so that you do not get trapped in any disease.

    ReplyDelete
  11. We serve as the Best SEO services Company in Aliganj adhering to provide and deliver distinctive and profitable SEO techniques for our clients. From off-page and on-page improvement to setting your claimed content link and media in a suitable position, we manufacture your site as absolutely SEO friendly for getting more shares, higher engagement, and altogether earn an identity as well.

    Tags-SEO Agency in Aliganj, SEO Company in Aliganj, SEO Company in Lucknow,

    ReplyDelete
  12. We serve as the Best SEO services Company in Aliganj adhering to provide and deliver distinctive and profitable SEO techniques for our clients. From off-page and on-page improvement to setting your claimed content link and media in a suitable position, we manufacture your site as absolutely SEO friendly for getting more shares, higher engagement, and altogether earn an identity as well. Our SEO Experts team at Youth Brain Trust use innovative web investigation apparatuses to collect information to benefit our clients.

    ReplyDelete
  13. YouthBrainTrust, one of the best digital marketing Services in Lucknow can enable your business to develop into a major goliath with the assistance of splendid digital marketing techniques. Take your business to another level with us. Digital Marketing Agency in Lucknow can assist you with accomplishing more customers through different methodologies, including content marketing, website improvement, email marketing, video marketing, etc. You can connect with digital marketing services in Lucknow that can assist you with finding the most proficient digital marketing procedure to develop your business.

    Tags- BEST SEO COMPANY IN LUCKNOW, BEST SEO COMPANY IN ALIGANJ, BEST SEO COMPANY, Digital Marketing Services In Aliganj

    ReplyDelete
  14. Technology is playing an important job, and it is more integrated into our lives than any other time. TOP SEO COMPANY IN LUCKNOW, As a great many people lean toward online shopping, it is important for businesses to have an online presence to push ahead. Today, digital marketing is perhaps the simplest ways that permit you to arrive at your brands to audiences using digital marketing services by the top digital marketing company in lucknow. Consequently to assist the various industries, in competition time, so numerous Digital Marketing companies running in the marketing industry. All Best digital marketing service providers are known for promoting businesses and helping them to make a more extensive reach with the right audience.

    Tags- Top digital marketing services, Best Digital Marketing Company in Lucknow, Seo Company in lucknow, BEST SEO COMPANY IN ALIGANJ,

    ReplyDelete
  15. seo in lucknow Running a business in the presentserious market isn't a simple errand as there are various organizations andbrands that sell nearly similar items and administrations. This is themotivation behind why you have to search for a specialist company that can assistyou with making your business mainstream on the online stage. BEST SEO COMPANYThe ranking ofyour Company on the internet is something that issues the most, by contacting a Best SEO company in Lucknow;you can guarantee that you get a decent ranking on various web indexes.Website improvement, SEO agency in Lucknow usuallyknown as SEO causes organizations to gain fame on the online stage. When acompany has a decent ranking on web crawlers, SEOCompany in Aliganj this is the point at which itturns out to be simple for a business proprietor to pull in more demographic onthe site which likewise helps in increase in the deals of a business. 

    ReplyDelete
  16. Youth Brain Trust is the event that you have a company however have no clue about working SEO services, consider hiring a SEO firm. Until utilizing any of these businesses, you should do a ton of examination to assist you with making the correct decision. You'll get a higher ranking spot on Google with the top SEO company in Lucknow, and your company website will gain more guests and real clients.
    Tags- BEST SEO COMPANY IN LUCKNOW, BEST SEO COMPANY IN ALIGANJ, BEST SEO COMPANY, SEO SERVICE IN LUCKNOW, Best SEO Services

    ReplyDelete
  17. The Website offers you the adaptability of uploading your whole item range in the type of appealing Color Images with incurring escalating costs. This helps your purchasers or customers to get the genuine visual feel of your items. Best Website Designing Company In Lucknow To put it plainly, the Website has a serious and fast correspondence instrument facilitating better business openings.
    Youth Brain Trust is the leading website designing in Lucknow with the objective of offering the usability of innovation in all areas at a reasonable cost. Digital services and arrangements must be reached out to clients so they don't feel disappointed. We have a group of experienced IT experts who skill in Web development and adjust all the necessities of your business and do top to bottom examination to assist clients with getting the best help.

    Tags- Website Designing Company In Lucknow, Website Designing Company , Top Website Designing Company In Lucknow , Website Designing Services In Lucknow , Website Designing Company In Aliganj

    ReplyDelete
  18. Website designing is the focal mainstay of any and each digital marketing effort. Websites, just to express the conventional definition, alludes to an assortment of web pages just as related substance, distributed on in any event one web worker and distinguished by a typical domain name. Best Website Designing Services in Lucknow, then again, alludes to different aptitudes and disciplines needed in the creation just as maintenance of a website. It incorporates interface design, authoring, client experience designing, and site improvement.

    Tags- Top Website Designing Services in Lucknow, Best Digital Marketing Company In Lucknow, Website Designing In Lucknow, Best Website Designing Company In Lucknow, Best SEO Company In Lucknow

    ReplyDelete
  19. Digital marketing is a different domain and we have gained aptitude in countless its branches or stages. Digital marketing offers you the chance to arrive at the most noteworthy number of individuals on the double without spending a fortune on it. This is the first run through in history whenever brands are getting such a chance. Youth Brain Trust. Helps these brands in exploiting this occasion to its fullest. Looking for Best SMO Company in Lucknow and we have manufactured our standing as a significant organization for Web Marketing.

    Tags- Best SMO Company in Aliganj, Best SMO Services in Lucknow , Best SEO Services in Lucknow, Digital Marketing Services In Lucknow, Best Website Designing Company In Lucknow

    ReplyDelete
  20. Best SMO Services in Lucknow Through the social locales the optimization is finished. This is a lot of required in light of the fact that without advancement prevalence is beyond the realm of imagination in this serious market. Individuals are dependent on the social media and consequently promoting through the destinations is useful. It will draw the consideration of the existing clients just as the individuals who are new. The marketing will help in increasing the traffic to the website. Social media optimization has become an integral piece of online administration of notoriety.

    Tags- Website Development Company in Lucknow, Digital Marketing Services in Aliganj, Best SEO Services in Lucknow, BEST WEBSITE DEVELOPMENT COMPANY BEST SEO COMPANY IN LUCKNOW, DIGITAL MARKETING TRANING IN LUCKNOW, Digital Marketing Services In Lucknow

    ReplyDelete
  21. We have been making quality web applications dependably increasing new pieces of information into what makes an ideal web application. Website Designing Services in Lucknow, Our consideration continually remains on how we can achieve the objectives spread out in the most gainful and simple to utilize way. Web application improvement incorporates various stages, from top-grade system, exact planning, essential examination, business counseling, plan, programming, testing and preparing. Our main target in website design is to make the websites easier to understand, simple to access and understandable to the online clients and that is the thing that makes us, Best Website Designing Company in Lucknow . Youth Brain Trust designs a website for your business or expert needs.

    ReplyDelete
  22. Youth Brain Trust is an accomplished web development company in Lucknow that sees how very much created and in fact unrivalled web items advantage more on the web than the rest. In the event that your site is powerless, jumbled and does not have the business principles, it can truly imprint the brand estimation of yours and repulse guests away. TOP DIGITAL MARKETING COMPANY IN LUCKNOW, Our top of the line site advancement administrations plan to reinforce a business’ online nearness and lift its prospects.

    ReplyDelete
  23. The technology has developed in such a way that the people have started using social media in their life. Best SEO Services in Lucknow So, if you want to promote your business then it is essential to use social media marketing. It involves promoting your business on social media platforms and getting the maximum response. However, the promotional post will have different requirements so that it can attract a huge crowd. Best SMO Company in Lucknow, If the business gets developed on Social Media Optimization then there are chances that you would get the desired results.

    ReplyDelete
  24. Many people believe that praising your body in any form is very important to stay happy. Order Cheap Phentermine Online, if the weight is high then the person can praise their body but they will have to try to reduce their body also. The reduction is not for a good figure or better body but for having a healthy life. Obesity is the reason for many diseases and the person cannot overcome that if they are not reducing weight.

    ReplyDelete
  25. The end of Halloween marks the days for Christmas and Thanksgiving. There are any people out there who are quite busy with their schedule and are looking forward to a small reunion with their family. Sometimes, getting to your family in Thanksgiving becomes tough and they end up going only for the Christmas. So, the best that they could do to compensate would be to bring gift for their loved ones at home. However, with the commencement of Christmas, there are many Best Christmas offer 2020 that will be attractive and useful.

    ReplyDelete
  26. The phentermine tablet also works in a similar fashion. The intake of the
    tablet will lead to a change in heart rate that ultimately results in
    reduction of weight through reduction in calories. The reduction in the
    calories will further help in increasing the fat metabolism. Buy Phentermine Online US However, there
    are some side effects of the tablet that the person should know before
    consuming it.

    ReplyDelete
  27. Theelp in getting offers and the stamps will get more popular if you are providing them on daily basis. So, before you launch the best Christmas offer, you can start sending out stamps and coupons for the offer. However, it will make the offer more popular if you call the people at the venue of your business to sell the stamps.

    ReplyDelete
  28. The usual parties are held during the Christmas. However, the parties during the holiday season might become very expensive. So, you can offer some discount to the people who would like to hold the party at your place. The discount should not be in term of money but you can try to give offers on drinks and food. So, that will help in getting the usual crowd and also in making the place more popular. Thus, getting the best Christmas deals today is very important because that will help in increasing the profits as well as popularity.

    ReplyDelete
  29. There are many drugs available in the market that guarantee to lose weight as well as get you in perfect shape. Buy Phentermine Online without prescription from us with ease. Those drugs may work by decreasing the level of your appetite, as well as increasing the amount of energy to be used by your body, or by affecting certain parts of the brain to perform the desired task as well.

    ReplyDelete
  30. The higher weight pushes the body towards a different regime that can harm the overall body. So, it becomes important for the person to try and lose weight. However, the same methods would not work on a single person. So, it is better to choose medication like Phentermine that can help the person in losing weight. You can buy phentermine online from the site to get instant weight loss.

    ReplyDelete
  31. The dose of the tablet starts from 8 mg, 15 mg and 30 mg. The person can consume the tablet three times in one day, Buy Phentermine online cheap half an hour before any meal. However, the consumption before meal is essential as it will help in enhancing the effects of the tablet. Moreover, if the dose is not monitored then there are chances that the person will suffer from side effects.

    ReplyDelete
  32. Christmas comes with a unique happiness that creates a festive atmosphere for all the people. Best Christmas deals The people not only get holidays but also get happy about celebrating the festival their friends and family. Moreover, Christmas is also considered as the season of gifting things to all the people. Gifting things can be amazing but not then when you would have no idea about what people want. So, the best way will be to give them a gift card, so that buy the things themselves without any issues.

    ReplyDelete
  33. The minor side effects are fever and nausea that the person can overcome whereas the severe side effects cannot be controlled. Buy Phentermine 37.5mg online The severe side effects can be seizure or even memory loss. The memory loss can lead to various problems that is tough to control. However, the best option is to make sure that you take doctor’s advice before consuming the tablet.

    ReplyDelete
  34. The best offers can be seen on the electronic items. Best christmas deals If you are planning to buy a camera or a phone then the offers in the market would lure you very easily. The usual offers will consists of flat discounts on the items that are either the last models or new models. Moreover, there are some offers that include things like getting earphones or pen drive free with some high rates electronic items. These are the offers only possible for the Christmas.

    ReplyDelete
  35. There are any people out there who are quite busy with their schedule and are looking forward to a small reunion with their family. Sometimes, getting to your family in Thanksgiving becomes tough and they end up going only for the Christmas. So, the best that they could do to compensate would be to bring gift for their loved ones at home. However, with the commencement of Christmas, there are many best Christmas deals in 2020 that will be attractive and useful.

    ReplyDelete
  36. Clothes are the some of the things that the people purchase at all times. So, getting an offer on some of favorite brands will help in getting the desired products. However, there flat sales and discounts in regular brans also that attracts the people. The other things that are important is the new collection that arrives only during best Christmas deals. So, this offers will help in getting the right kind of deal.

    ReplyDelete