Sometimes I need a temporary file or a temporary directory with a unique name in my scripts. Of course I can create a file in
/tmp with the actual time in its name. But what if some other user has the same idea, and the scripts run at the same time? Here comes
scp are the usual programs to login to a remote host and to copy files from or to a remote host. Normally users just start the program and type their password. But this is not very convenient, and even impossible, if these programs are used in a script which has to run automatically, e.g. as a cron job.
Continue reading “ssh Keys”
Sometimes I want to view a file without editing, but want to use some features of vi (or vim). Of course I can just use
$ vi file.txt
but then I can accidentally change the file.
There are two parameters, which can help.
In an earlier post we learned how to start a daemon with systemd. But it is annoying to handle a user daemon this way: type every time a
sudo in front of the
systemctl command. Let’s configure it, so that it can be used as a normal user.
While editing a file I have often the problem to do the same tasks repeatedly on many (or even all) lines, e.g.:
- appending a semicolon to the end of every line,
- commenting some lines in a shell script,
- creating SQL statements from a list of tables,
This can be done with keyboard macros.
Continue reading “vi: Keyboard Macros”
For my sensor network I run a server process, which collects the data from several sensors. This is a sort of a daemon. In a first version it was started in a crontab with the time “@reboot”. But during the development I had to restart it every now and then: search the PID, kill it, start it in the background.
Isn’t there a better way? systemd to the rescue. In this first systemd post I will install a service file, so that the process can be started and stopped from the root account.
Everyone knows the command
cd – everyone uses it several times a day. (OK – not everyone, but every Linux user.) Most of us know, that we can change back to the last directory with
$ cd -
$ pwd /home/maker/docs/sensors $ cd /opt/sensors/bmp280 $ pwd /opt/sensors/bmp280 $ cd - $ pwd /home/maker/docs/sensors
But what if you cd in your project directory and then need to change back into your docs directory? You have to type the whole path. Or do you?