Difference between revisions of "User:Girts:Linux Notes"

From DiLab
Jump to: navigation, search
(How to copy files using hard links)
Line 47: Line 47:


== How to copy files using hard links ==
== How to copy files using hard links ==
Thic command is good for making incremental backups: first copy old files and then sync (using rsync) the new files to newly created directory having hard links to old files.
<pre>
<pre>
cd source-dir
cd source-dir

Revision as of 11:37, 26 June 2009

How to mount SSH file system in Ubuntu

From this site.

To mount remote director /home/share from host example.com to local folder /mnt/share, using ssh user remuser and local user locuser:

sudo apt-get install sshfs
sudo mkdir /media/share
sudo chown locuser /media/share
# local user must belong to the fuse group
sudo adduser locuser fuse
sshfs remuser@example.com:/home/share /media/share

Enter ssh user password when asked.

How to run script over SSH and keep it running after SSH is closed

  • SSH into the host
  • run screen <your-script>
  • detach screen by pressing Ctrl+A Ctrl+D
  • you can close the SSH session and the script will remain running
  • to return to screen session afterward, issue screen -r

How to change timezone

sudo dpkg-reconfigure tzdata

How to mount CIFS file system

sudo mount -t smbfs //192.168.0.1/shareName /mnt/dest-dir -ousername=remoteuser

How to convert RPM package to DEB package

sudo apt-get install alien
sudo alien -k name-of-rpm-file.rpm

How to find UUIDs of partitions

ls -l /dev/disk/by-uuid

How to synchronize two local folders

rsync -va --delete /src/folder /dst/folder

--delete means "delete files on destination, which are deleted on source".

How to copy files using hard links

Thic command is good for making incremental backups: first copy old files and then sync (using rsync) the new files to newly created directory having hard links to old files.

cd source-dir
find * | cpio -dplm dst-dir

dst-dir should be outside of src-dir