DEV Community

Cover image for The Linux Command Line
jones268
jones268

Posted on

The Linux Command Line

If you're a Linux user, or you know someone who is, you've probably heard of the "command line". But what is it? Is it hard to learn? Will it turn you into a geek?

The command line is something that anybody can learn and enjoy using. It's a special way of interacting with your computer, by typing short commands instead of clicking around in menus.

Although it's easy to use, the command line does take a little getting used to, because it's very different from what most people are used to.

On top of that, there are many different commands. It can take a long time to become an expert without training. You can use this site to boost your Linux skills.

Why command line?

I'll start with a simple statement of fact: the command line is here to stay. It's a powerful, flexible interface that allows the user to control the computer directly, without reference to a GUI.

The Linux command line is a powerful environment for a computer programmer. But it takes time and practice to become proficient at it.

To understand what the command line is, you should first know what it’s not. It’s not a graphical user interface.

linux command line

The command line sits between your computer and programs. Anything run from the terminal is called a “command” or a “shell”.

You execute a command by typing it into the terminal and pressing return or enter, depending on your shell.

Essentially, it’s everything you type at a prompt or run standalone, like scripts and programs.

Linux command line

The commands are not only useful on Linux but also on Mac OS X. As both use the bash shell. But even with different shells like on OpenBSD, the commands are largely the same.

start programs

You can start a program by typing the name of the program like this:

./name
Enter fullscreen mode Exit fullscreen mode

navigate directories

You don't need a file manager, browsing your file systems is one of the things you can do with the command line.

# list files in directory
ls

# enter directory
cd dir

# go up one directory
cd ..

# go to root
cd /

# go to home directory
cd ~
Enter fullscreen mode Exit fullscreen mode

view files

To view files, you can use these commands

# show file
cat filename

# show first lines of file
head filename

# show last lines of file
tail filename
Enter fullscreen mode Exit fullscreen mode

edit text

Text editing is great on the command line. Especially for config files but also for development.

# vim editor (ZQ to exit)
vim filename

# nano editor (beginners)
nano filename
Enter fullscreen mode Exit fullscreen mode

Moving from soydev to unix hacker really boosts your skills. It makes you so much more proficient at development.

These days you can even use a Linux terminal inside windows, the command line is included on Mac OS X and almost every web server in the world uses the command line.

Top comments (0)