Terminal Emulators

There are several choices when it comes to terminal emulators, here are a few in order of popularity.

Gnome Terminal

The default Gnome Shell terminal, comes as standard with Fedora

Terminator

A more customisable terminal with tiling options

Installation

1
sudo dnf install terminator -y

Note

Make sure to enable infinite scrolling, to do that right click on your terminator window select Preferences -> Profiles -> Select Profile or Create new one -> Scrolling and tick the checkbox for "Infinite Scrollback"

Hyper

https://hyper.is/

Javascript/Node terminal with customisable plugins

Installation

For Fedora, download the RPM from:
https://releases.hyper.is/download/rpm

Once downloaded, install with:

1
sudo dnf install ~/Downloads/<downloaded_rpm> -y

Hyper will initially complain when first started about missing configuration files, it will create these automatically on first run. This can also occur when install plugins.

Popular plugins can be found on the Awesome Hyper curated list https://github.com/bnb/awesome-hyper

Keyboard Shortcuts

1
Ctrl+R

Allows to search for previously used commands

Rerun previous command

1
!!

Represents the previous command For example: sudo !!, which sudos previous command

1
2
3
4
./requiresSudo
# Fails
sudo !!
# Works

!letters

Combines to two commands. This will run the last command that started with the letters, i.e.

1
2
3
4
rm -f ./
# lots of commands, none of which start with rm
cd /
!rm

This saves one key stroke and introduces an element of excitement into running commands.

Clear Shortcut

1
CTRL + L

As opposed to typing clear you can use the above shortcut to clear your terminal window

Last directory

1
cd -

Takes to last directory you were in.

Reuse last parameter

1
[ALT]+[.]

Gives lastly used parameter

1
2
rm somefile
# After pressing [ALT]+[.] it would give us "somefile"

Reuse different parameters

1
!:[\d]

This give you access to one of more of the parameters used in the last command. For example

1
2
3
touch one two three four five six seven eight nine
echo !:4
# four

This can also be used with ranges

1
2
3
touch one two three four five six seven eight nine
echo !:4-6
# four five six

As this is using History Interaction, all of the manipulation that you may need is also available

1
2
3
4
5
6
pwd
# /home/edmonds
ls -l /vaw/www/vhosts/www.example.com/app/etc/env.php
cd !:1:h
pwd
# /vaw/www/vhosts/www.example.com/app/etc

Tip

You can use !$ for the last argument and !^ for the first one as a short hand

Open current command in editor

1
[CTRL]+[x] then [e]

Opens the content of the command line in the system editor, which is likely to be vim.

You can then edit the command and then run it by closing the file. Useful for when you have a long command and realise that you've missed something from the middle of it

Tip

If the editor is not vim, you can make it the default editor by setting the EDITOR variable in your bashrc file

Delete from current command

Until previous space:

1
[CTRL]+[w]
1
2
3
./path/to/command argument1 argument2 unwantedArgument
# Press [CTRL]+[w]
./path/to/command argument1 argument2

Delete until previous non-alphanumeric character:

1
[ALT]+[Backspace]
1
2
3
cd /path/to/folder/notThisOne
# Press [ALT]+[BackSpace]
cd /path/to/folder

Commands

History

1
history

Displays the entire bash history. Useful for grepping

Listing folder contents

1
ls

List takes a few common parameters:

  • ls -l shows a table view with permissions, modifications etc
  • ll or ls -la shows hidden items (those prefixed with ".")
  • ls -latr shows all files ordered by modification time
  • ls {any-phrase}* will show you files starting with the phrase

SCP

1
scp [-P 123] {username@host}:{remote/path/to/file} {/local/path/to/destination}

By executing this command you can copy files from remote machine to your local computer. Swap the parameters for copying to a remote host.

Viewing files/output

  • head -n [numberOfLinesToDisplay] [filename] shows the first n lines
  • tail -n [numberOfLinesToDisplay] [filename] shows the last n lines

Copying files to and from remote hosts

  • scp {username@host}:{remote/path/to/file/you/want/to/copy /localhost/path/to/where/you/want/to/paste