Tips to Remember about Linux Commands

Tips to Remember about Linux Commands

 

You “open” a Linux terminal emulation window “on” a Linux desktop to get to the prompt so you can run commands. Here are some great tips you may never have considered when working in Linux terminal emulation windows.

Linux Terminal Emulation Window Interface

A Linux window has a border around it, a scroll bar with scroll arrows at on the right side and three “buttons” in the top right corner of it.

The Minimize, Maximize and Close Buttons On A Window

There are the three “buttons” named Minimize, Maximize and Close at the top right of any terminal emulation window. The top right button is used to close a window, the middle button is used to maximize a window so that it fills the screen (which helps you to see more!), and the left button is used to minimize the window so that it is still available, but is “in the background” and doesn’t cover anything on the Linux desktop.

Moving From One Linux Terminal Emulation Window To Another Window

Here’s an easy way to move from one Linux terminal emulation window to another: just press and hold down the Alt key, press the Tab key until the window that you need appears, and then let go of both keys.

To close a window you can: click on the “X” in the top right corner of the window, or type in: exit and press Enter, or press Ctrl+d.

Opening And Working In More Than One Linux Terminal Emulation Window

You can open more than one terminal emulation window on the Linux desktop at a time – and this is great! This allows you to run Linux System Administration commands in one window and also run commands to do other tasks in other windows, such as run commands to view documentation files, or run a command to see the memory usage in your system.

Copying From One Linux Terminal Emulation Window To Another

On some Linux desktops, you can copy the text of a Linux command, or the output of a command, from one terminal emulation window and paste it in another. To do this, you select text with your mouse in one window and press Ctrl+c to copy it – or right-click in the window and select Copy to copy it – and then press Alt+Tab to go to the other window and press Ctrl+v to paste it – or right-click in the window and select Paste to paste it!

Tab completion

This tip is for the novice. There are a lot of commands on the Linux operating system in  /usr/bin directory there is 1736 commands. Hard to remember all of them. Or sometimes a command will have a number of variations and sometimes, it’s just tiring typing all of those commands. Fortunately the Tab key is there to help you out. Open up your terminal window and do the following:

Type beagle

Hit the Tab key twice

You should see a complete listing of all commands that start with beagle. Say you want to run beagle-index-info. You can do this by typing beagle-ind and then hitting the Tab key one time.

Run second command with first commands arguments

Say you need to find out what the directory /home/jlwallen/.e16/themes contains, but when you run the command ls /home/jlwallen/.e16/themes you see that the directory doesn’t exist. Looks like you will have to create that directory. Normally you would do this by typing mkdir /home/jlwallen/.e16/themes (or mkdir ~/.e16/themes). You can use a neat little trick to take the arguments from the previous command and add them to a new command like so:

mkdir !*

Search your bash history

If you can’t remember how you ran a specific command, you can use your bash history to help you. If you hit <Ctrl>r you will be in a special bash search prompt that looks like:

(reverse-i-search)`’:

From this prompt you can enter a portion of the command and immediately see a command that contains what you type. If the command is the one you are looking for, hit the Enter key to execute that command.

Another method of searching bash history

This one is simple. If you can’t remember the last few commands you entered, just hit the up arrow on your keyboard to look through the list. When you find the command you want to run, hit Enter.