Month: January 2014

How to run a program every time a user logs in to Linux (and where the startup configuration files are stored)

Sometimes new Linux users want to know how to run a particular command or shell script every time a user logs in (which also implies that if it’s a single-user system, this could be a command that runs when the system starts). In Ubuntu and its many variants, you can simply place the startup command in Ubuntu’s Startup Applications Preferences, as we demonstrated in the article, Enabling a SOCKS proxy via SSH tunnel in Ubuntu or Mac OS X at startup.

Ubuntu Startup Applications Preferences - adding SOCKS proxy
Ubuntu Startup Applications Preferences – adding SOCKS proxy

However, you may be on a variant of Linux that doesn’t have a Startup Applications Preferences program, or maybe you simply want to add something from the command prompt. Or maybe you want to tweak an existing startup command to do something different. The key to this is that the startup configuration files for each user are stored in the ~/.config/autostart directory (where ~ is the user’s home directory). The actual format of the files may differ between different variants of Linux, and some versions may not utilize them at all, but if that directory exists on your system, that’s probably where they are stored. There are also system-wide autostart files; those are found in the /etc/xdg/autostart directory, at least on Ubuntu-based systems.

For example, referring back to the command to activate a SOCKS proxy when Ubuntu starts (the first example in the article referenced above), what happens when you create that command in the Startup Applications Preferences is that it creates a file named ~/.config/autostart/screen.desktop (the filename will be different for each autostart command), which in turn contains the actual script that’s run at startup (similar to this example):

[Desktop Entry]
Type=Application
Exec=screen -dmS tunnel ssh username@server_address -D local_socks_proxy_port
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=SSH Tunnel
Name=SSH Tunnel
Comment[en_US]=SSH SOCKS proxy tunnel
Comment=SSH SOCKS proxy tunnel

The startup scripts can contain much more than just this. When you install certain programs that autostart, they will write considerably more complicated configurations. In Ubuntu, you can take a look at the /etc/xdg/autostart/update-notifier.desktop file as an example of a more complex configuration file.

Possibly the best way to figure out the format of these files is to take a look at several of them in the directories mentioned above, since they may well differ to some degree in different versions of Linux. There are other ways to start programs at startup in Linux, but they may run at system startup before a user has logged in, or they may only execute if a user logs in using a terminal session, but not when they bring up a desktop session. The method shown here is supposed to work no matter how a user logs into the system. And, it can sometimes be useful to know where Linux stores its configurations.

Link: Car Mp3-Player with the Raspberry PI

Everyone likes the Raspberry PI because you can do so much interesting things with it really easy. I ever wanted a own Mp3-Player with a nice display for my car and i tought that the Raspberry would be a good solution to start with. So i bought a Raspberry PI and some other parts to start with my project. After a bit of soldering, getting into the GPIO stuff and wiring all the components together i got the first problems with my project. I overcame all issues and have Listed you a complete tutorial do make this player so if you want to copy it of make a better version of it 🙂 you wont have the same issues i had to build my geek device here.

Full article here:
Car Mp3-Player with the Raspberry PI (Sentcool`s Projects)

Link: Securing Your Asterisk VoIP Server with IPTables

Now that you have set up your personal Asterisk® server, it’s time to secure it. I can’t overstate the importance of this step. Without it, you could be leaving your server’s VoIP and SSH ports open for anyone on the Internet, which is a very bad idea and may cost you a lot of money.

Full article here:
Securing Your Asterisk VoIP Server with IPTables (Lin’s Tech Blog)

Link: Top 10 Things to Connect to Your Raspberry Pi

During my time with the Pi I’ve experimented with various devices and sensors. Here is my Top 10 list of devices to connect to the Raspberry Pi. In most cases they are very cheap and easy to interface and are great building blocks for more complicated future projects. I’ve included links to more detailed posts where I can and many of these include example Python scripts to help you get going.

From robot cars to security systems there are plenty of ways of combining these mini-projects into some amazing creations! If you need to buy a present for a Pi owner then these are good starting point.

Full article here:
Top 10 Things to Connect to Your Raspberry Pi (Raspberry Pi Spy)

Link: Understanding the Linux df And du Commands

Although it is possible to get information about disk usage from within the various Linux desktops, those who are comfortable with the command line can get much greater detail using the df and du commands. With these two commands, not only can you discover details about the free space on the mounted file systems, but you can also see the amount of space used by individual directories.

Full article here:
Understanding the Linux df And du Commands (Make Tech Easier)

If you tried upgrading XBMC under OS X, run a MythTV backend, and get the error “No PVR Client has been started yet”, see this thread

This thread contains information on the buggy XBMC version 12.3 for OS X, and a couple of suggestions for reverting back to XBMC 12.2, which will fix the problem for now.  This issue does NOT appear to be present in Linux versions of XBMC 12.3.

Link: 30 Linux TOP Command Examples With Screenshots

The top command in Linux displays the running processes on the system. One of the most important tools for a system administrator. It is used extensively for monitoring the load on a server. In this article, we explore the top command in detail. The top command is an interactive command. Many commands are available when top is running. We will explore these commands as well.

Full article here:
Unbelievable ! 30 Linux TOP Command Examples With Screenshots (LinOxide)

Link: How to remote control Raspberry Pi

Once you have a fully working Raspberry Pi system, it may not be convenient for you to continue to access Raspberry Pi directly via a keyboard and HDMI/TV cable connector dedicated to Raspberry Pi. Instead, you will want to remote control “headless” Raspberry Pi from another computer.

In this tutorial, I will show you how to remote control your Raspberry Pi in several different ways. Here I assume that you are running Raspbian on your Raspberry Pi. Also, note that you are not required to run desktop on Raspbian when trying any of the methods presented in this tutorial.

Actually that last quoted line does not appear to be quite correct — the first three methods shown don’t require a desktop, but the fourth involves using VNC, which pretty much assumes a desktop will be present. And if were were considering using VNC, we might also want to consider Nomachine NX, which can support multiple simultaneous sessions that each have a separate, independent desktop, and is also faster than VNC in some situations. Although, we’ve never tried installing it on a Raspberry Pi.

Also, some or all of these tips may be useful for controlling Linux remotely regardless of the actual hardware that is in use — in other words, these are by no means exclusive to the Raspberry Pi.

Full article here:
How to remote control Raspberry Pi (Xmodulo)

Link: Do More, Faster In The Linux Terminal With Midnight Commander

This is the program we always install first in any new Linux-based installation, and if for some reason we can’t install it, that system tends to get blown away and replaced by a different version of Linux (or whatever) almost immediately. Not being able to install Midnight Commander is kind of a deal-breaker around here.

File browsing in a Linux terminal is alright, but it could be so much better. Midnight Commander is the program you’re looking for –  it gives you a two-paned file browser that makes working in the terminal so much easier. And the best part? It’s simple to get and use.

Full article here:
Do More, Faster In The Linux Terminal With Midnight Commander (MakeUseOf)

We’ll just add that even some Mac OS X users are apparently lost without Midnight Commander, since an older article on installing it under OS X is still one of the most popular on this site, even though for day-to-day use, we would think that most OS X users would be happier with the more recent versions of XtraFinder, which now includes dual pane functionality (and it’s free!). As for Windows users, there is always the venerable Total Commander.

Recent Posts

Recent Comments

Archives

Categories

Meta

GiottoPress by Enrique Chavez