ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

5 Basic Linux Terminal Commands

Updated on May 2, 2016

The Linux Terminal: Use Ctrl+Alt+T To Begin With

For most Windows users, using 'cmd' might have never occurred to you given how GUI driven the World's most popular operating system truly is.

Linux, on the other hand, can be a bit different. This is because since its inception, users were mostly geeks, who preferred using the 'command line'.

Yes, that's the generation I grew up in given that Windows 3.x or even 95 were still in development for years.

Which begs the question: what is this “command line”?

It is simply a window (also called the Terminal) that allows you to type certain commands that will help you perform certain functions – sometimes far more efficiently compared to the graphic user interface.

That said, the commands in Windows as well as in Linux are usually the same with a few exceptions, of course.

Yet in order to get started, hit Ctrl+Alt+T on Ubuntu (or any other Linux distro), to open a Terminal window, much like the one below:

Fig. 1: The Command Line - Ctrl+Alt+T
Fig. 1: The Command Line - Ctrl+Alt+T

Using the Linux Terminal - What's the Big Deal, Anyways?

When I first started using Linux a few years ago, there was always a desire to learn how to use the command line fluently.

Yet any learner, who does not understand as to why this is important, might not put much effort into his or her learning in the first place.

The first thing that came to mind was if we do have a File Management system that allows us to do away with the command line, then what's the point of learning it in the first place. After all, most of us have a number of things on our plate each day and learning how to use the command line might not be top on those lists of things to do.

While that's true, if there's anything that learning a few Linux command line commands can help you with is to speed up certain tasks if not more than you can imagine. This is only if you take the time, of course!

Probably the simplest thing that I can think of here is the scenario where you might have to transfer about 20,000 images from a folder that has varying file types. Well, you can use the mouse and keyboard to select the files, right?

Yes, you can. But that takes so much more time than entering a single command that can copy these files in no time without error. Not unless you make a mistake with the command itself.

Speaking of which, it's best to learn a few simple commands before moving on to running more complex tasks with the Linux command line.

Fig. 2: The "command line" in Windows. Circa 1993. No Windows 3.x.
Fig. 2: The "command line" in Windows. Circa 1993. No Windows 3.x.

1: The "Working" Directory

Step #1: Type "pwd"

Step #2: Hit Enter

Step #3: That's it.

Now the purpose of this command is for you to see the directory that you in. Once you know where you are located in the Linux file system, you can use other commands to move to certain directories and sub-directories.

In this case, as in Fig 3 shown below, the location is home/swapan...

Now if you want to move to another directory - to access a few files - the next command should help you with that.

Fig 3: The Working Directory
Fig 3: The Working Directory

2: Listing Files in a Directory

Step #1: Type "ls".

Step #2: Hit the Enter key.

Step #3: Look at the files (marked in white) and directories (marked in blue) as shown in Fig 4.

Now if you want to move to another directory, there's a command for this. But before we get to that one, let's look at how you can clear your screen if it has too much information on it.

Fig 4: Listing Files in a Directory
Fig 4: Listing Files in a Directory

3: Clearing Your Screen

Step #1: Type "clear"

Step #2: Hit Enter.

Step #3: That's it. You should clear your screen with the command prompt at the top of your screen.

Refer to Fig 5 below to see the results.

Fig 5: Clearing Your Screen
Fig 5: Clearing Your Screen

4: Changing Directories

Now there are a few ways by which you can use the "cd" command.

The first way to do this is by typing: cd <foldername>. In the example below, there are three folders: Files, Archive & Assorted.

In order to change the working directory from Files to Archive (the latter being a sub-directory!), type cd Archive. If you want to go one step lower, then type cd Assorted. That's it.

Conversely, if you want to move back up from Assorted to the Files folder, you can type twice: cd ..

(Remember: there's a space between "cd" and ".." that you must not forget. You can also use the ls command if you do not know Folder names in each directory.)

Fig 6: Changing Directories...
Fig 6: Changing Directories...

5: Making a New Directory

Step #1: In order to make a new direction, type mkdir <foldername> at the command prompt.

Step #2: Now type "ls" to look for the directory created. (Look at Fig 7 for the folder named "daniel".)

Step #3: Finally, if you want to navigate to that directory, use cd <foldername> to move to that folder.

Fig 7: Making a New Directory
Fig 7: Making a New Directory

Using the "man" command

The "man" command is an interesting one since it throws up information about the particular command that you might wish to use. In most cases, you might not know what that command does.

For example, type "man clear". Hit Enter.

Once you do this, you'll find information about the clear command as shown in Fig. 8 below.

Fig 8: The "man" page for the clear command
Fig 8: The "man" page for the clear command

In Closing

Now, that we've learned 5 new Linux terminal commands, it's a good idea to play around with them as you move through various directories on your file system.

As soon as you begin using these commands fluently, there's a host of commands that you can try out on your own.

One last thing: if you want to learn more about the command line, this book by Williams Shotts is a good starting point. Don't worry - none of us were born geeks - we all had to start somewhere.

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)