As root, execute one of these depending on the desired action:
echo -n mem > /sys/power/state # suspend to ram echo -n disk > /sys/power/state # suspend to disk
Credits / Source: TipsForLinux’s post.
As root, execute one of these depending on the desired action:
echo -n mem > /sys/power/state # suspend to ram echo -n disk > /sys/power/state # suspend to disk
Credits / Source: TipsForLinux’s post.
This post is intended for you fellow users of Xfce, a window manager and suite of applications.
The Thunar file browser is a very interesting of these applications:
The one awesome feature we discuss here is about incrementing your configuration with custom actions for files and directories that are made accessible via their context menu.
Now for the 3rd field, “Command” here is the very nice and handy part:
Insert a command of yours to do something. In my case, I want to rename files so that they do not have special characters. I will do this by invoking the xfce4-terminal (obviously, also from the Xfce suite of applications) which in turn invokes bash with its -c option (which receives an argument string comprised of commands to be evaluated i.e. executed).
Here ‘s the code:
xfce4-terminal -x bash -c '/path_to_script/renameok.sh %f'
The script renameok.sh iterates through directories renaming their files stripping special characters. Soon a post will be included containing its source code and explanation.
If your script (generally referred to as script.sh instead of the specific renameok.sh) depends on stuff setup in .bashrc (the shell resource file) then just call bash with -i (bash -ic “command(s)”) which sets the interactive mode on and calls the resource file before executing the -c option commands. Also realize that when in an interactive session, if script.sh is in a PATH setup by .bashrc you are safe to remove the /path_to_script/ part of script.sh ‘s call as it will be thus found. And last, as my .bashrc can have some echo commands in it, I will deliberately add a clear command before the script call so that the resulting code will look like:
xfce4-terminal -x bash -ic 'clear; renameok.sh %f'
Now, in the Appearance Conditions tab uncheck every options but Directories as in this example we use the directory in which the context menu was invoked as the script ‘s argument (as it wants a directory path). This indeed causes the action to be available only for directories’ context menus in Thunar. The main purpose in this tab is for you to choose which type(s) of files (directories are a type of file) you want the action to be executable.
In the custom action entry edition dialog, still, notice the bottom of the window, which explains the meanings of the expansions including the %f shown in the examples herein. One interesting and awesome thing is that Thunar is also smart enough to realize that the actions must not be made available if more than one file (or directory, as in these examples) are selected in case you are using %f. Conversely, the action is selectable both for just one file or for multiple files when using %F instead.
To know more check the official wiki entry.
Enjoy! ;)
Use the env utility, like this:
env ENV=”.kshrc” screen ksh
This is needed because ksh called like this is not a login shell (which loads .profile which, according to ksh’s man, is a good place to export ENV with the rc filename) but an interactive shell, so we need to setup ksh’s special parameter (variable) ENV on the fly.
Below are some useful commands for listing and manipulating file permissions on Unix systems.
The commands presented below are towards setting up permissions for the directory tree for collaborative work i.e. with folks contained within the same Unix group.
# Alter files' group ownership to somegroup: find . -user "${USER}" -exec chgrp somegroup {} \; # Give dirs. read (r), write (w) and e(x)ecution (access) for its group owner: find . -user "${USER}" -type d -exec chmod g+rwx {} \; # Regular files rw permissions for group owner: find . -user "${USER}" -type f -exec chmod g+rw {} \; # Recursive (-R) chmod for all files (including dirs.) in the current dir. tree: chmod -R g+rw .
It is also good to set the umask to take out all the permissions from just the “others” set of users:
umask 07The following script finds git repositories under your current working directory (represented by ‘.’ i.e. a dot):
gitpulls() { echo "$(find . -name '.git' | sort)" | while read i; do cd "$(dirname ${i})" echo ">>>> pulling $(dirname ${i#./}) ... <<<<" git pull echo '' cd - > /dev/null; done unset i }
After defining it (possible in your .profile, .bashrc, .kshrc etc.), navigate to the desired (a common ancestor to your git repositories) directory and call it:
gitpulls