Lawrence Wright

  • About Me
  • Portfolio
  • Services
  • My Blog
  • Facebook
  • Twitter
  • Email
  • Subscribe RSS
Nov 12, 2014
0  
  • Facebook
  • Twitter

Easy Essential Linux Commands For Beginners

For the past several years, Linux has been gaining heaps of traction in the OS market. People are starting to realize that there are actually other operating systems out there! Needless to say, and though I hate to admit it, I have to give Apple some credit for this since most people prior to their rise thought Windows was the only operating system in The Universe. I've just recently shifted all my computing to exclusively Linux based operating systems, and I have to say it's one of the best decisions I've made for my career.

If you're interested in Linux, or want to give it a shot, there're some basics you need to know first! Linux isn't as intimidating as tech enthusiasts make it seem to be, and in most cases, it's much easier to run a Linux OS than working on Windows or Mac based PCs. I don't know very many people that understand what a tree is in Windows console, or how to change a directory with a simple command. You do need to know some bash scripting in order to get the most out of a Linux operating system because it's fairly universal. All distros essentially use the same kernel. I'll go over some basics, as these commands will work on all Linux based operating systems (Debian, Ubuntu, and Red Hat distributions).

Linux Process Monitoring

The top command is by far one of the easiest to learn, and safest commands in Linux. There's nothing that could go wrong! In addition, typing this up in the terminal gives you a world of information about your running processes. It's great for finding out what system processes are consuming the most memory and CPU, and is a great starting point for troubleshooting issues. The top command is simply typed in the console like this.

top

That's really all you need to type. I can get into the synopsis and all the finer details, but I'll save that for another post since you won't really need to do much with top when you're first starting out.

Directory Navigation in Linux

Although you may have a GUI to navigate directories, sometimes you'll want to jump in the console and take a deeper look at your files. You can't run commands in a folder GUI, so sometimes it's best to view your files and directories through the console. Here're some ways you can navigate your Linux file system. Disregard the text after "#" as those are comments. Don't worry if you copy these commands with the comments, it's safe to copy them and paste them in your terminal. Nothing will happen.

cd       # Change your current directory to your home directory.
cd ..    # Takes you back one directory.
cd /root # Navigate directly to the /root directory.
cd dir   # Go to the directory called "dir" in your current folder.
cd -     # Takes you to the previous directory you were in.

All cd commands are safe, so don't worry if you find yourself in the /dev/ directory! As long as you don't try to run some crazy file manipulation bash commands, you'll be fine, no problem!

If you ever get lost, just type pwd and the full path of your location will be printed.

To get a directory listing of all files in your current directory, type either dir or ls for just the file and directory names, or type ls -all for a detailed listing.

Power Management in Linux

Rebooting and shutting down a Linux machine is easy. Now this one could result in data loss depending on how you handle it, but as long as you're not running any software with open files or need to save something, this should be relatively safe. It's the same as Windows, so play it smart.

reboot   # Restarts your Linux machine.
shutdown # Powers down your Linux machine.

Retrieving Information About Your Linux System

Are you wondering how much space you're using? Or do you want detailed information on your hardware in a user friendly way? Linux has hundreds of commands that help you do this. Of course most have to be installed, by default there are some included with every distribution.

date    # Display the current date on the system.
df -h   # Display your HDD space usage.
df -i   # Display your HDD inode usage.
free -m # Displays your current memory usage.
cat /proc/cpuinfo # Detailed information about your CPU.

There are many commands to check your system information, but that should suffice for now while you're still learning.

Common Linux Commands

The rest of the commands I'll tell you about are fairly universal. Do you know how to install a package? Maybe you'll use a package manager, but you can install just about anything through the command line. Maybe you want to know how to update your operating system and software through the console. That's right! Unlike Windows, you can update your entire operating system and all installed packages with one single command. It's easy, and convenient. This is what sets Linux apart from the other operating systems.

Although highly unlikely, the commands from here on could potentially damage your system if used improperly. Don't try to install a million packages or edit files you don't understand.

The following only pertains to Red Hat distributions (Fedora, CentOS, Red Hat, etc,.).

yum install package-name # Install packages.
yum update package-name  # Update packages.
yum update               # Update entire operating system.

The following only pertains to Debian distributions (Debian, Ubuntu, etc,.).

apt-get install package-name # Install packages.
apt-get update package-name  # Update packages.
apt-get update               # Update entire operating system.

To edit a text file within the console, type nano filename. To exit that text editor, just hold down CTRL + X. If you've made changes to your file, be sure those changes are safe, then press Y, then ENTER. To discard changes, press N, then ENTER. If you don't have the nano package installed, you can install it with yum install nano for Red Hat distributions, or apt-get install nano for Debian distributions. Alternatively, you could go with the Vi editor, but that's a bit more complicated and I don't suggest using that until you're familiar with the console.

There are many other commands you can learn, but take what's in this guide and practice them a bit. There's little chance you'll damage your system by sticking to this guide. I'll push out more guides as I blog a bit more now that I've simplified my website! If you have any requests, feel free to shoot me a message.

Related Posts

  • Setup Remote Ubuntu Deskt...

    Have you ever wanted to connect to an Ubuntu desktop using your Windows remote desktop connection? With the power of xRDP, you can, and it's not very difficult to setup; Just follow along.

    Find out more
  • Easy Essential Linux Comm...

    For the past several years, Linux has been gaining heaps of traction in the OS market. People are starting to realize that there are actually other operating systems out there!

    Find out more

Category

Crypto Currency
Drupal
Games
Linux
Personal
Reviews
Security
Social Media
Webmasters
Websites
WordPress
Writing

Lawrence Wright © 2014. All Rights Reserved.

Terms | Privacy