I’m trying to run Python scripts with a shebang on Ubuntu. When I create a python script #! /usr/bin/env python import sys … and run it I get a shell error: root@host:/home/user# ./test.py : No such file or directory How can I make it work? Solution: Remove ‘r’s from line endings with dos2unix. I assume the script is executable? Also, check for carriage returns — maybe windows got its dirty little hands on it? You [...]Continue Reading »
Previously, when setting up a *NIX environment for the first time, I would put all of my shell customisations into .bashrc, with the following .bash_profile: if [ -f $HOME/.bashrc ]; then . $HOME/.bashrc fi However, based on this answer and its associated comments, I’ve recently moved my PATH redefinition into .bash_profile. What types of commands do you feel should go into .profile, .bash_profile, .bashrc (and any other dotfiles), and why? They are read or not [...]Continue Reading »
I’ve been searching and collecting links for a lot of them, but many of these tools don’t have enough use case or demonstration documentation to be able to evaluate their potential worth without installing and trying them out. I am hoping that people here have experience with some of them and can offer feedback regarding how easy they are to install, and use. My personal use case is a couple of machine pools that are [...]Continue Reading »
How do I get root access from shell? When I’m trying to use su I get: default@default-laptop:~/home/default$ su Password: su: Authentication error default@default-laptop:~/home/default$ su wants the root password, if you’re running Ubuntu that will be scrambled. Try sudo -s -H or sudo su – and give your user password. Check more discussion of this question. Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers Tweet about it Print for [...]Continue Reading »
example -rwxr–r– 1 me users 0 May 27 13:58 file_0 -rw-rwxrw- 1 me users 0 May 27 13:58 file_1 -rw-rw-rwx 1 me users 0 May 27 13:59 file_2 -rwxrwxrwx 1 me users 0 May 27 14:02 file_3 I would need to list all 4 files in the current dir AIX non-gnu ‘find’, so “find . -executable” won’t work find . -type f ( -perm -u=x -o -perm -g=x -o -perm -o=x ) worked for me. [...]Continue Reading »
I use it regularly (cmd), but let’s be frank, its environment sucks. No tabs, resizing the window is a pain, … and so on. Console2 and PowerCmd fix some of these problems. But still, I’d love to know are there any other environments for cmd shell. If you know of any, do tell. I’ve also heard of Terminator and Poderosa. Check more discussion of this question. Bookmark on Delicious Digg this post Recommend on Facebook [...]Continue Reading »
I need an ability to run “svn update” on a remote machine for a non-technical user, how would I go about it? Our non-techincal users are using Windows XP and have Tortoise SVN client installed. I’m thinking to do following but I’m not really in a favor for either so far… Batch (that runs locally on Windows) Shell (runs on a remote machine requires SSH access/client) CGI (that runs on a remote machine via web) [...]Continue Reading »
I am adding a feedback form to a web page and would like to know if it is safe to simply filter the contents of the TEXTAREA element (after decoding) through the ‘mail’ command to send an e-mail to the page’s maintainer. I have looked at the man page and cannot see a way to abuse this, in particular as long as ‘mail’ does not run in interactive mode, tilde escapes are disabled and ‘.’ [...]Continue Reading »
In a linux command line, you zip a file by: zip -mqj archive.zip file.txt Now, I need to store ‘file.txt’ as ‘file2.txt’ in ‘archive.zip’, without renaming the file before zipping. When unzipped, the file should be called ‘file2.txt’. How can I store the file with a different name? Read through the MAN page and didn’t find an answer. Does creating a hard link to file.txt count? ln file.txt file2.txt Create file2.txt which points to the [...]Continue Reading »
I just had to build two instances of daemon running on different ports. let’s say they both serve critical missions for some applications. How can I do some automatic task (eg. shell script) execution for checking both of daemons when one of them fails to serve? What kind of script that can always check the daemon’s life and maybe can execute some other jobs if one of the daemons incidentally stopped? monit is great in [...]Continue Reading »
- SCP transfer only modified files
- How can I automate clearing and resetting a Linux user’s home directory to a default?
- Cron expression that runs every 5 minutes from 1:30 am – 6:00 am [duplicate]
- Understanding redundant power supplies
- Is there a way for administrators to disable users from installing Firefox extensions?