Tarball – a computer file format that can combine multiple files into a single “tarball” file.
Usually used:
tar zxvf tarball.tar.gz
also could be used:
cat tarball.tar.gz | tar zxvf -
Month: August 2012
Copy files/folders accross a network in Linux using ssh, tar, scp and rsync.
SCP or secure copy is probably the easiest of all the methods, its is designed as a replacement for rcp, which was a quick copy of cp with network funcationability. Before scp does any copying it first connects via ssh. SCP encrypts data over your network connection, but by using the -C switch you can compress the data before it goes over the network. This can significantly decrease the time it takes to copy large files.
scp -r directory user@server:~/
or default port
scp "-P 7787" -r directory user@server:~/
TAR is usually used for achiving applications, but what we are going to do in this case is tar it then pipe it over an ssh connection. TAR handles large file trees quite well and preserves all file permissions, and works quite well with symlinks.
tar -czf - directory | ssh -p 7787 user@server tar -xzf - -C .
or default port
tar -czf - directory | ssh user@server tar -xzf - -C .
or
tar -xzf - directory | ssh user@server "cat > /directory/tarball.tar.gz"
or
dpkg -l | ssh user@server "cat > /directory/dpkg-list.txt"
RSYNC speciality lies in its ability to analyse files and only copy the changes made to files rather than all files. This can lead to enormous improvements when copying a directory tree a second time.
rsync -avze "ssh -p 7787" directory user@server:~/
or default port
rsync -avze ssh directory user@server:~/
How to disable a user account
Use usermod --expiredate 1 username
instead of passwd -l username
.
Passwd -l does not disable an account, just makes the password unusable, but the user could still login using an ssh key or other auth meth.
By the way, I know a lot of admins who made this mistake 😉
Vim commnads.
You can save a lot of time when navigating through text by using appropriate movement commands.
Here are some basic commands:
e
Move to the end of a word.
w
Move forward to the beginning of a word.
3w
Move forward three words.
b
Move backward to the beginning of a word.
3b
Move backward three words.
$
Move to the end of the line.
0
Move to the beginning of the line.
^
Move to the first non-blank character of the line.
)
Jump forward one sentence.
(
Jump backward one sentence.
}
Jump forward one paragraph.
{
Jump backward one paragraph.
H
Jump to the top of the screen.
M
Jump to the middle of the screen.
L
Jump to the bottom of the screen.
20
Move 20 pages up.
10
Move 10 pages down.
G
Jump to end of file.
1G
Jump to beginning of file the same as gg.
10G
Jump to line 10.
'm
Jump to the beginning of the line of mark m.
`m
Jump to the cursor position of mark m.
''
Return to the line where the cursor was before the latest jump.
``
Return to the cursor position before the latest jump.
%
Jump to corresponding item, e.g. from an open brace to its matching closing brace.