~nijaba/ubuntu-server-tips/newtips

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Ubuntu Server Tip: Want to run your own cloud infrastructure in your
enterprise? Ubuntu Enterprise Cloud powered by Eucalyptus has what you need:
http://www.ubuntu.com/cloud
%
Ubuntu Server Tip: Did you know that you can get useful notifications
displayed at the bottom of a terminal by using the byobu package?
http://launchpad.net/byobu
%
Ubuntu Server Tip: 'screen' can create multiple "windows" which you can
detach and re-attach later. The Byobu package makes screen even
simpler. http://launchpad.net/byobu
%
Ubuntu Server Tip: The powernap package allows you to suspend servers which
are not being used, and save energy.  https://launchpad.net/powernap
%
Ubuntu Server Tip: 'etckeeper' allows you to save changes you make to /etc
in a bazaar repository. Useful to track and revert
changes. http://tinyurl.com/etckeeper
%
Ubuntu Server Tip: Your KVM powered virtual machines will do IOs up to seven
times faster if you enable virtio. http://tinyurl.com/virtio
%
Ubuntu Server Tip: The Ubuntu Server Team is an open community always
looking for feedback and help: https://launchpad.net/~ubuntu-server
%
Ubuntu Server Tip: Did you know that releases of Ubuntu labeled LTS are
maintained for 5 years on servers? 'cat /etc/lsb-release' will tell you
which release you are on.
%
Ubuntu Server Tip: Browse the command line history with ctrl-r and then type
a few characters that you know are part of the command you are looking for.
%
Ubuntu Server Tip: Edit the command line with cut and paste: ctrl-k for cut,
and ctrl-y for paste.
%
Ubuntu Server Tip: Reach the end-of-line with ctrl-e and the beginning of
line with ctrl-a.
%
Ubuntu Server Tip: Instead of typing the user and group, if they are the
same ( like for www-data ) you can just type the user followed by a colon,
e.g. "$ sudo chown -R www-data: *"
%
Ubuntu Server Tip: Use the "which" command to find if an executable is in
your path, and if it is, where you can find the file. e.g. $ which nano
%
Ubuntu Server Tip: Instead of typing exit or closing the terminal if you
want to logout you can press Ctrl+d.
%
Ubuntu Server Tip: Use 'tail -f file' to watch a log file as messages get
appended, and use 'tail -100 file' to change the count of lines read from
the file (to 100 in this case).
%
Ubuntu Server Tip: An easy way to see what processes own which network
connections: "sudo netstat -tup" for established connections and "sudo
netstat -tupl" for listening daemons.
%
Ubuntu Server Tip: The "history" command will show you the commands you've
used before, alternatively you can use the up arrow button to look through
them.
%
Ubuntu Server Tip: To make a backup without typing the full path twice: $ cp
/long/path/to/file/name{,.orig} to create a copy with the suffix .orig
%
Ubuntu Server Tip: If you executed a command and neglected to use sudo, you
can execute "sudo !!" to re-execute the previous command with sudo
prepended.
%
Ubuntu Server Tip: Install "denyhosts" to help protect against brute force
SSH attacks, auto-blocking attempts.
%
Ubuntu Server Tip: Use "iotop" for measuring hard disk I/O (current read /
write) usage per application.
%
Ubuntu Server Tip: If you are using a PostgreSQL database, use "ptop" to
monitor real time usage.
%
Ubuntu Server Tip: Use "iftop" to monitor current network activity
connections per host.
%
Ubuntu Server Tip: Use "pastebinit" to copy a file, or output of a command
to a webpage allowing you to share it with others. e.g. "pastebinit
/proc/cpuinfo" or "df -h | pastebinit"
%
Ubuntu Server Tip: Use "tail -f /var/log/some.log" to see new lines added to
a log instantly in real time.  Ideal from watching webserver requests as
they happen.  Can also be used in conjunction with "grep".
%
Ubuntu Server Tip: Save time by starting to type a command or file name,
then press tab to complete. Hit tab twice to bring up multiple completion
options.
%
Ubuntu Server Tip: Append your ssh key to your server's authorized keys file
using the command "ssh-copy-id user@server_address"
%
Ubuntu Server Tip: If you want to download a file from a URL via the
console, you can use the command "wget http://address/to/file.tar"
%
Ubuntu Server Tip: To manage Apache modules use "a2enmod" to enable and
"a2dismod" to disable. e.g. "sudo a2enmod rewrite"
%
Ubuntu Server Tip: To manage Apache virtualhosts use "a2ensite" to enable
and "a2dissite" to disable. e.g. "sudo a2ensite example.org"
%
Ubuntu Server Tip: Use "top" to get a view of your server's performance
such as processor, memory and swap utilisation and to see a rolling display
of the top cpu using processes.
%
Ubuntu Server Tip: If you need to perform a command a second time on a
different file, you can use command replacement with the ^ symbol. e.g. "cp
foo.txt /to/some/directory" then "^foo^bar", expanding to: "cp bar.txt
/to/some/directory".
%