Skip to main content

Posts

Showing posts with the label command

Tmux quick start guide

Tmux is a handy terminal manager that allows you to switch between terminal sessions easily. Without losing history or windows upon ssh disconnects or similar. It is like screen , just better. (First of all because of using client-server based technology... ) Here is my minimal keyboard shortcuts guide that allows you to start using Tmux in a blink of an eye. Endless advanced commands and hotkey combinations you could always find by entering "man tmux" in a terminal. Tmux is installed quite easily in most of common linux based systems. Just type: Ubuntu: $ sudo apt - get install tmux CentOS: $ sudo yum install tmux This allows you to start using by starting it with $ tmux a | | tmux new This command first tries to attach to existing running tmux instance and creates new in case it is not found. Ctrl+b d - Will allow you to disconnect at any time. (This is also a way it is happening when you loose ssh session. How to connect - look earlier) Each sess...

5 most common Rsync command usage examples

rsync is a command for remote sync. It is used to synchronise one location to another in a simple way. Location is meant to be local directory, server or remote web server or whatever accessible by ssh. Advantages of using rsync over other tools is speed and bandwidth requirements. First time rsync copies entire contents of the directory provided and increments changes over next sync times. Command syntax: $ rsync options source destination 1. Synchronising local directories: $ rsync -zvr /tmp/logs/ /tmp/logs1/ building file list ... done created directory /tmp/ logs1 ./ log. log sent 98 bytes received 48 bytes 292.00 bytes/sec total size is 0 speedup is 0.00 $ Used rsync command options here: -z is for compression -v is for verbose output -r is for recursive directory scanning By default rsync does not preserve timestamps.  2. Preserve timestamps and permissions during sync: $ rsync -azvr /tmp/logs/ /tmp/...

How to delete a remote git tag

I'm always forgetting this. So decided to put it here for someone's benefit. I have the git tag added by command: git tag -a 1.2 . 0 -m "1.2.0" this means my tags tree will be updated with the tag 1.2.0 and message 1.2.0 Usually it marks the version of the build/release. I now push a tag to origin by command: git push origin --tags It is possible to see it at my repository github tagged. Time now to delete a tag. It can be done by command: git tag -d 1.2 . 0 This will remove a local tag 1.2.0. Leaving origin intact. Pushing tags to origin does not give anything. To remove a remote tag now it is required to execute command: git push origin :refs/tags/ 1.2 . 0 It will remove tag 1.2.0 at origin. This is the only way how to move tags to another commits.

Django 1.5 migrating to new url tag syntax

Django 1.5 changed. The url tag syntax from {% url  my_page %} into {% url "my_page" %} . Now all my templates should be changed accordingly to migrate to 1.5. You could do it with executing this command in your bash shell. Assuming you are in the project folder. Assuming you have version control, or do know how to backup your work ;). Some people claim it is unsafe. But you may want to make it safer with adding '{%' to the beginning of the string. To make sure only templates arre changed. Or either execute this only in your templates folder to be sure. $ find . - type f - print0 | xargs - 0 sed - i 's/ url \([^" >][^ >]*\)/ url "\1"/g' And one person did a django snippet for this operation. You may also find it useful.  http://djangosnippets.org/snippets/2905/

Raspberry Pi boot applications Autorun

I had a problem with running required programs upon system startup. I had to set up hdparm utility each time system boots up. I have 2 external HDD's connected and require setting their sleep time for 10 minutes each boot. So setting this up. The answer is found at Debian administration guides.  I'll provide it in the end of the article. Here is my decision based on that: So to set up a program to run on system boot. (In fact one of the system run-levels). You can add it's name. But a good practice will be to add an  sh script with execution of this utility an all the parameters. Sample script is: #! /bin/sh # /etc/init.d/blah # # Some things that run always touch /var/lock/blah # Carry out specific functions when asked to by the system case " $1 " in start ) echo "Starting script blah " echo "Could do more here" ;; stop ) echo "Stopping script blah" echo "Could do more here...