3 Linux commands and shortcuts I wish I learned on day one

Configurare noua (How To)

Situatie

As a beginner, I used to feel like I was fighting with the command-line interface. It did eventually click for me, but I wish it happened sooner. This is a list of command-line actions and commands that I wish I had learned on day one.

Solutie

Clear

Clears the screen

This is a standard command across all Unix and Unix-like systems. Use it when the terminal screen is filled up with text. Just type clear and hit Enter. Or, use the Ctrl+L keyboard shortcut. This is probably going to be your most used action in the terminal, so I suggest picking either and sticking to it to build up muscle memory.

Copying and pasting text

The regular keyboard shortcuts won’t work

Pressing Ctrl+C in the terminal cancels the previous running command. The terminal has its own keyboard shortcuts for cutting and pasting text (technically called killing and yanking text). You can move the cursor back and forth with arrow keys. Place the cursor where you want to cut the text and then press Ctrl+K. This will cut the text to the end of the line in the terminal. You can also go the other way and cut to the beginning of the line with Ctrl+U. To paste text copied from within the terminal, press Ctrl+Y to paste it.

To paste text from outside the terminal, most modern terminal emulators will use Ctrl+Shift+V.

Moving around and reading files or folders

The navigation essentials

To locate your current directory, use the print working directory command.

pwd

Use cd or change directory to hop to a different directory.

cd /home/

To list files inside a directory, we use the ls command. Entering ls will list files in the current working directory. You can either cd into your target directory first and just enter ls, or you can type the exact address with the ls command.

ls ~/Downloads

The hidden files won’t show up by default. You can pull them up with the -a tag. This lists all files.

ls -a

To view extra information about files, use the -l option.

Tip solutie

Permanent

Voteaza

(1 din 2 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?