Recently I had to create a bash script to copy some files based on date.
The rule was copy yesterday’s files to …
But How to determine what was the yesterdays date?
The answer was in date man page.
Here are the parts from the script related to yesterday date:
$date -d '1 day ago' +'%Y/%m/%d' 2011/06/02
on Internet I’ve found also:
date --date='yesterday' Thu Jun 2 14:01:28 EDT 2011
And (Bonus!!) if you want to go in future 😉
date --date='tomorrow' Sat Jun 4 14:04:29 EDT 2011
I love screen – it allows you to detach you console and still have the program running.
For more info:
Recently I experienced following error:
$ screen -r
Cannot open your terminal '/dev/pts/0' - please check.
After searching for solution I found several instructing to change permissions etc.
But different solution, almost “hack” is the one I like.
Before starting screen type:
And after that you can type:
Only drawback is that you need to type one additional exit for script to terminate.
Credits for this to Harry Jackson. Unfortunately the resource was not available so i did to put a link to the site.
The root password is the key to any Unix/Linux system and the person who knows it is with full rights. But there is a simple way to crack root password.
Just type at terminal:
echo '82 43/25 43+65P80P82P73P76P32P70P79P79P76P10P' | dc
In FreeBSD by default you do not have bash as shell prompt.
Here is the procedure to install it:
- type whereis bash
- cd to that folder
- type make configure
- make all install clean
- take a cofee 😉
- type chsh -s /usr/local/bin/bash root to change the shell for root or replace root with username you want to change the shell.
- Then relogin (logout and login) to enjoy bash shell
Most of “ux” users and administrators use remote terminal to connect to administrared machine.
One of the popular choises, minly because of it’s portability is PuTTy only putty.exe is needed and no installation is required. In addition it is free.
Downside is that sometimes there are problems with terminal emulation – not necessary coming from putty, but still annoying.
One of my problems is that when vim is in insert mode arrow keys do not work. For long time I was no able to find solution to the problem, but finally i found one. Just type this in your home folder:
echo syntax enable > ~/.vimrc
This did the trick for me. Hope it helps to you too.
Update of the update:
The 184.108.40.206 release fixed some 200 issues, but accidentally regressed a few things. Most users wonâ€™t see any difference or experience any problems, and those 200 fixes make the 220.127.116.11 update very valuable, but you should never have to choose functionality over security. So weâ€™re working fast to understand and fix these problems, and will shortly be issuing a 18.104.22.168 update to address them. The specific problems are:
- Bug 400406 – Firefox will ignore the â€œclearâ€ CSS property when used beneath a box that is using the â€œfloatâ€ property. There is a temporary workaround JS/CSS code available for web developers with affected layouts.
- Bug 400467 – Windows Vista users will get â€œJava not foundâ€ or â€œJava not workingâ€ errors when trying to load Java applets after updating. To fix this, users can right-click the Firefox icon and â€œRun as administratorâ€, then browse to a page with a Java applet â€” doing this once will fix the problem and permanently restore Java functionality.
- Bug 396695 – Add-ons are disabled after updating. Users can fix this problem by opening their profile folder and removing three files (extensions.rdf, extensions.ini and extensions.cache)
- Bug 400421 – Removing a single area element from an image map will cause the entire map to disappear. There is no workaround available at this time.
- Bug 400735 – Some Windows users may experience crashes at startup. There is no workaround available at this time.
QNX announced that the company makes available the source code of his Neutrino RTOS (real time operating system) microkernel via newly created QNX Foundry27 portal.
At Foundry27, customers and developers can access a wealth of resources relating to the QNX Neutrino RTOS and the QNX Momentics IDE, as well as to new community projects.
Finally one mature realtime kernel code is available …. (bad news is that it is released under dual licensing).
Have you already write the code and have the need to keep track of changes or keep different versions with possibility to revert easily to previous version?
Do you still have those problems?
If so the tool you may need is called subversion and is available for Linux/Unix/MAC OS X and Windows.
How to use it?
It is relatively easy especially if you create local repository:
1. You need to install the binary version or compile from source code (the procedure is described for CentOS 5, but sould not be drastically different for other OS’s except fro installation part)
yum install subversion
2. Next step is to create repository – it must be done on the machine where repository will reside
svnadmin create <path to local directory>
3. After you create repository next step is to import data
svn import <folder> <repository> -m "<log message>"
- folder – direcrtory where your data reside
- repository – file:///<path to repository> Note there are 3 slashes
- log message – something meaninfull probably something like “first import”
4. Rename the folder
mv folder folder.beforesvn
5. Create working copy of the data
svn checkout <repository> <working copy>
6. Start working and send changes to repository with
Note that you need to be in “working copy” folder.
Today I removed the user in my Linux workstation.
Probably you will say that this is simple task just remove user home directory and his password, but appears that this is not.
First thing is that there is no single command that will do this task for you.
1. Lock user – this is done with following command:
passwd -l <user_name>
This command will achieve it by changing the password to a value that cannot be matched by any possible encrypted value.
This command is usefull also for temporary disabling user account.
2. Search for and kill any user processes that still run
ps aux | grep -i ^<user_name>
kill -9 <PID number>
where <PID number> is the number in the column just after the user name.
3. Find all files that belong to this user
find / -user <user_name>|less
4. Decision time – decide do you want to keep those files or erase them. My suggestion is to backup them just in case.
5. List and remove any crontab jobs
List user cron jobs:
crontab -u <user_name -l
And if you see any entries remove them:
crontab -u <user_name> -r
6. Remove user from sudoers (if you use sudo)
7. Check any other applications as remote access, MySQL, Web App.
More extended howto