Linux Using Notes

restart ssh

On Ubuntu:

1
sudo systemctl restart ssh

usermod | Grant User sudo privileges

1
sudo usermod -aG sudo nameOfTheUser

useradd | Add User

1
2
3
4
sudo useradd -m whateverNameYouLike
sudo passwd nameOfTheUser
sudo usermod --shell /bin/bash nameOfTheUser
su nameOfTheUser

tzselect | Set Timezone

A simple, user-friendly timezone settings guider.

1
tzselect

Remember to add a line in ~/.profile according to instructions given by tzselect.

clean | Clear Terminal Screen

A simple command to clear the terminal screen.

1
clear

screen | A Terminal Multiplexer

What does it do?

There are several cases you want to use screen to manage your terminals.

  • You are connecting to your Linux machine using ssh, but the job is time-consuming. You don’t want to keep the ssh window open, but killing it will also kill the process.
  • You are using Linux desktop. You want to hide a terminal when you not need it and resume to the status right before you hide it.

screen does the job perfectly. It serve as a layer between the terminal users see and the actual processes.

How to Use it

To create a new screen:

1
screen -S whateverNameYouLike

To list all screens:

1
screen -ls

To reattach to a screen:

1
screen -r theNameOfTheScreen (and then hit tab to complete it)

or

1
screen -r theIdOfTheScreen (and then hit tab to complete it)

To end a screen:

1
screen -S screenIdYouWantToKill -X quit

If you are in a screen, you can do the following operations:

I will use @ to refer to Ctrl+A

To detach the screen: press @+D.

To create a window in a screen: press @+C.

To navigate to the previous/next window in a screen: press @+P/N

To list all windows in a screen: press @+W.