The First 8 Linux Commands Every New User Should Learn

Trending 2 days ago
Backlit keyboard
aryutkin photograph / iStock / Getty Images Plus

Follow ZDNET: Add america arsenic a preferred source connected Google.


ZDNET cardinal takeaways

  • Start pinch nan basics and get comfy utilizing nan Linux terminal.
  • Man pages are your champion friend erstwhile you get stuck.
  • The much you practice, nan faster Linux starts to click.

I retrieve erstwhile I started utilizing Linux successful nan precocious 1990s. Back then, using nan bid line wasn't optional. If you worked pinch nan open-source operating system, you had to walk clip successful nan terminal. Even worse, if you needed to do thing pinch admin privileges, you had to alteration to nan guidelines personification aliases moreover log successful arsenic root, which could beryllium a information nightmare.

Using nan bid statement successful nan past was challenging because location wasn't arsenic overmuch thief arsenic today. I was connected my own. Thankfully, I struggled done and became proficient. With nan thief of man pages (manual pages for commands), I survived those early days. Of course, nan irony of maine putting successful each that difficult activity is that using nan bid statement isn't a request now.

Also: The astir beautiful Linux distributions for 2025

Yet I retrieve what it was for illustration learning those commands. At first, it was a struggle, but slow nan acquisition stuck. Those foundations made it easier for maine to proceed onward and created a coagulated guidelines from which to build.

Although these commands are alternatively rudimentary, you should return your first steps and usage nan commands suggested below. Not only will they beryllium nan astir adjuvant arsenic you get started, but they'll besides beryllium nan commands you usage nan astir -- astatine first.

Let maine explicate why I judge each caller personification should study these 5 Linux commands.

ls

The ls bid lists nan contents of a directory. When you tally ls, it will show you each folders and files wrong nan directory and thing else. But ls does person a mates of tricks up its sleeve. 

Also: 7 Linux commands I can't unrecorded without aft 20 years successful nan terminal

For example, opportunity you want to spot nan specifications of nan files and folders successful that directory. You would adhd nan -l action (which stands for long list). When you rumor nan bid ls -l (which tin besides beryllium tally arsenic ll), you spot nan permissions, owner, group, size, and creation day and clip of each record and folder.

Another useful summation is nan -a option, which stands for all. If you person hidden directories (directories that commencement pinch a .), nan only measurement to spot them is to tally nan bid ls -a. You could moreover harvester l and a pinch nan bid ls -la, which will show nan specifications of each files and folders successful your directory.

cd

The cd bid is what you usage erstwhile you request to alteration directories. For example, opportunity you are successful your location directory (sometimes noted ~/ aliases /home/USERNAME, wherever USERNAME is your Linux username) and want to alteration to nan Documents directory. 

Also: 5 obscure Linux distros you've astir apt ne'er heard of - but should decidedly try

For that, you would tally nan bid cd Documents. What if you want to alteration into nan Documents directory successful ~/, but you're not successful ~/? That's an easy switch. Since ~/ is shorthand for /home/USERNAME/, you could rumor nan bid cd ~/Documents. Or, if you're successful immoderate directory connected your drive, you could alteration to your location directory pinch nan bid cd.

As a bonus, if you ever request to cognize what directory you're presently successful (known arsenic nan existent moving directory), you tin rumor nan bid pwd, which will people retired nan full way for nan directory.

rm

Is location a record aliases files you want to delete? If so, you tin usage nan rm command. Say, for instance, you person /home/colette/test.txt and want to delete it. For that task, nan bid would beryllium rm /home/colette/test.txt. Of course, you could usage nan shorthand rm ~/test.txt.

Also: I ditched Linux for Windows 11 for 1 week - and recovered 9 large problems

To delete a files is simply a spot trickier. If you person nan files ~/test and rumor nan bid rm ~/test, you will person an error. That correction will hap because you person to usage nan r action (for recursive). This action deletes nan contents of trial and past deletes nan folder. The bid for that process is rm -r ~/test.

There's 1 much trick. If you want to beryllium other observant erstwhile deleting folders, you could usage nan interactive method, which asks you earlier it deletes anything. For that, nan bid would beryllium rm -ir ~/test.

cp

If you request to transcript a file, you usage nan cp command. For example, let's opportunity you person nan record ~/test.txt and you want to make a transcript of it. You can't create a transcript of a record and sanction it nan aforesaid point (unless you're creating nan transcript successful a different directory). If you want to spot nan transcript successful a different directory, nan bid is thing for illustration cp ~/test.txt ~/Documents/. 

Also: 5 reasons you should ditch Windows for Linux today

You should statement that I didn't person to specify a record sanction successful nan 2nd half of nan command. However, if you want to spot nan transcript successful nan aforesaid directory, you should specify nan caller record sanction for illustration this: cp ~/test.txt ~/test1.txt. You tin create a transcript successful a different directory and rename it for illustration this: cp ~/test.txt ~/Documents/test1.txt.

mv

The mv bid stands for move and makes it imaginable to move a record aliases files from 1 location to another. If you want to move ~/test.txt into nan Documents directory, that bid is mv ~/test.txt ~/Documents/. Notice that I didn't adhd nan record sanction to nan 2nd half of nan command. It's very overmuch for illustration nan cp bid successful that regard.

Also: My apical 5 screen-recording apps for Linux - and they're each free

The mv bid is besides what you usage erstwhile you want to rename a record (without making a copy). For instance, opportunity you want to rename ~/test.txt to ~/testing.txt. For that process, nan bid is mv ~/test.txt ~/testing.txt. And, yes, you could besides move and rename nan record simultaneously, for illustration this: mv ~/test.txt ~/Documents/testing.txt.

mkdir

If you want to create a directory successful Linux, you tin do truthful successful 2 ways: utilizing your GUI record head aliases nan bid line. Using nan record head is awesome and all, but sometimes it's inconvenient. Say, for example, you request to create a directory successful /usr/svr/. Maybe you're creating a directory to location information that will beryllium shared crossed your LAN, and you don't want to stock it from your location directory. 

Also: The astir versatile Linux distributions you tin instal correct now - and I've tried them all

If that's nan case, you'd request to unfastened nan record head pinch admin privileges, and that's not ever easy.

Instead, usage nan bid line.

The bid for this is mkdir. You tin create directories pinch ease, specified arsenic mkdir ~/zdnet. Now, if you request to create that subdirectory in, say, /usr/srv, you'd request to usage sudo for illustration so:

sudo mkdir /usr/srv/zdnet

No request to unfastened your record head for nan task. Besides, if you've utilized Secure Shell to entree that machine, nan bid statement is what you person astatine your disposal, truthful mkdir should beryllium considered a must.

little

When I want to position nan contents of a file, I ever move to nan less command. The less bid is simple: it displays nan contents of a file, and that's it. There are different commands for this, specified arsenic cat, but I've ever preferred utilizing less.

Also: Linux desktop frozen? My 5 go-to tricks to effort - earlier forcing a difficult reboot

Confession time: I've ne'er utilized a azygous action pinch nan less command. I conscionable tally it as-is.

Let's opportunity you person nan record zdnet.txt and you want to position nan contents. For that, you would tally nan bid (from wrong nan directory lodging zdnet.txt):

less zdnet.txt

See really easy that is?

man

The man bid is utilized to publication manuals for commands successful Linux. I've utilized this truthful overmuch complete nan decades, and it has made learning commands (or their galore options) easier than having to flick astir connected nan internet. Say, for example, you want to study astir nan less command. To do that, you would issue:

man little

Any clip a bid stumps you (or you request to fig retired which action is necessary), caput correct to nan manual for that bid and commencement reading.

Also: The champion Linux distros for beginners successful 2025 make switching from MacOS aliases Windows truthful easy

I will pass you that sometimes nan man page for a bid tin get really lengthy, particularly if nan bid successful mobility has a batch of options. Take your time, publication done it, and you'll study a lot.

One last statement

I've shown you nan basics of each command. When you first commencement utilizing Linux, that's each you'll need. However, arsenic you support going, you mightiness request to usage nan much precocious features of those commands. The champion spot to commencement is nan manual pages (as indicated above), which are disposable connected your system.

Also: 5 of my favourite Linux distros fresh to usage retired of nan container - nary setup required

Enjoy taking your first steps pinch nan Linux bid line. Once you're acquainted pinch nan supra commands, you're fresh to return connected much analyzable devices and level up your Linux skills.

A terminal -- besides known arsenic a shell, console, aliases terminal emulator -- is wherever you interact pinch nan Linux operating strategy utilizing text-based commands.

Show more

You tin unfastened a caller terminal model by opening your desktop paper and searching for "terminal." Open nan app by clicking nan resulting icon for your distribution's default terminal app.

Show more

  • ls | grep KEYWORD (where KEYWORD is nan connection you want to find)
  • ps aux | caput -n 5 | tail -n 3
  • Use wildcards (e.g., *.txt for each files pinch a .txt extension).
  • Work pinch symbolic links (ln, readlink).
  • Create impermanent files utilizing mktemp.
  • Run inheritance processes utilizing nan & characteristic (such arsenic ls &). Or usage && and & successful a azygous command, for illustration so: find /path/to/directory -type f &> find_output.log && ls &.

You tin modify your ammunition configuration record (~/.bashrc being 1 of nan astir wide used) to alteration settings like:

Show more

  • Prompt style
  • Auto-completion options
  • Command history and navigation
  • Aliases (although it's amended to adhd aliases to ~/.bash_aliases)

Be cautious pinch delicate data, usage unafraid protocols for information transportation (ssh, scp, sftp), and beryllium mindful of permissions erstwhile executing commands that whitethorn impact strategy security. Also, usage nan -i action (for interactive) erstwhile deleting files truthful you don't accidentally delete thing you need.

Show more

Get nan morning's apical stories successful your inbox each time pinch our Tech Today newsletter.

More