If you have a Debian-based system, once you've got everything installed, you can create a Debian repository from it and use that repository for installing additional similarly configured systems, or you can use it as a source for a re-install in the event that your system somehow becomes corrupted.
To do this, install the package dpkg-dev. You can install it with apt-get from the command line, or you can install it using a GUI package manager, such as Synaptic.
Now, create a directory—for example, my_repo. This will be the root of your repository. Under this, create a directory named binary. Next, copy all the .deb files from /var/cache/apt/archives/ into the binary directory. Then, go to the my_repo directory, and run the command:
$ dpkg-scanpackages binary /dev/null | gzip -9c > binary/Packages.gz
This creates your packages list. After that, save the whole my_repo directory onto another system. Then, change the /etc/apt/sources.list file, and add the path of the my_repo:
deb file:///home/boss/my_repo binary/
Now, reload the repository list and check your new repository.
Sometimes you may need to type the same thing repeatedly, whether it's filling out a form or typing a common word or phrase over and over again. There is a simple program for Linux called xte that allows you to control virtual key presses and mouse gestures that are sent to a program. xte is part of the xautomation package. It should be available through your package manager. For Debian-based systems, you can run:
$ sudo aptitude install xautomation
Once the package is downloaded and installed, you can use xte from the command line, like so:
$ xte 'sleep 5' 'str hello world'
This command waits five seconds and then types the string “hello world” into whatever application has focus. You not only can send strings, but you also can send key presses. So, let's say you want to send the key press for Enter, after you send the string “hello world”. Simply do the following:
$ xte 'sleep 5' 'str hello world' 'key Return'
There are a number of keys that can be sent using xte. Some modifier keys include Shift_L, Shift_R, Ctrl_L and Ctrl_R. As you can see, xte not only can send a Ctrl key press, but it also can distinguish between left and right Ctrl key presses. This is important, because some programs have different functions for the left and right Ctrl keys.
When typing the command for these key presses, keep in mind that the commands are case-sensitive. For instance, key Return will work, but key return will not. Use the xte --help command to get a full list of useful keys that you can send.
You can use xte for many useful things. Let's say you type your name, or maybe the name of your company, a lot throughout the day. You easily can create a script with xte that will send the string of information and then link that script to a set of shortcut keys for your desktop environment. So, instead of typing out “Johnson, Joseph and Jack's Law Office”, you simply can press Ctrl-Alt-N, and the script will type it for you.
I also use xte for was controlling Compiz on the touchscreen in my car. Without a mouse or keyboard, I was unable to use some of Compiz's useful features, such as scaling. So, after setting scaling to be controlled by moving the cursor to the top-right corner of the screen, I added an icon to the GNOME toolbar that ran a script that did the following:
$ xte 'sleep 1' 'mousemove 9999 0'
The first number (9999) is the X-axis value, and the second (0) is the Y-axis value. This command waits one second, which allows me to lift my finger from the touchscreen before the cursor moves, and then relocates the mouse cursor to the far right of the screen and up to the very top. Now, in combination with my Compiz settings, I can press the icon on my toolbar and get a nice view of all my open windows. I click the one I want, and I'm off and running. This makes touchscreen usage much more convenient and raises the cool factor a bit.
xte has many options I haven't touched on here (such as mouse clicks and holding a key or a mouse press for a given amount of time). I hope it has sparked an interest in you to give it a try and play with some. It just may be the tool you need to get a job done.
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal
- Users, Permissions and Multitenant Sites
- New Products
- Flexible Access Control with Squid Proxy
- Security in Three Ds: Detect, Decide and Deny
- High-Availability Storage with HA-LVM
- Tighten Up SSH
- DevOps: Everything You Need to Know
- Non-Linux FOSS: MenuMeters
- Solving ODEs on Linux
- Nmap—Not Just for Evil!