Tag Info

Hot answers tagged

15

Easy trick for alias in $(compgen -a); do type $alias; done


7

You can almost definitely just do: alias >>./bash_aliases


3

It can be omitted if it is the last character of the event line. First, we check what ^string1^string2^ meaning from man bash: ^string1^string2^ Quick substitution. Repeat the previous command, replacing string1 with string2. Equivalent to ``!!:s/string1/string2/'' (see Modifiers below). So ...


2

You can use rename (it's designed for that). Just execute this command in the folder where the *.gz file are: rename -n 's/\.gz$//' *.gz This removed the .gz extension from all files that have a .gz extension. Output should look like this: hibernate.queries.hbm.xml.gz renamed as hibernate.queries.hbm.xml jbpm.businesscalendar.cfg.xml.gz renamed as ...


2

This script may be helpful: for dir in /var/www/vhosts do if [ -d dir] then cp -r DIR_TO_COPY $dir/htdocs fi done


1

If you can install the rlwrap utility, then it is as simple as doing rlwrap ./yourscript.sh This will allow you to use the up and down array keys to browse through history, as well as the right and left arrow keys for editing the current command, for programs that do not support it already.


1

With all do respect, but I don't think the above code/answer is correct. if [ -d dir] is probably an attempt to if [[ -d "$dir" ]].. or [[ -d "$dir" ]];.. The following code should work and do what you want. vhostdirs=( ./var/www/vhosts/* ) for dir in "$vhostdirs" do cp -r "folder_to_be_copied" "$dir/htdocs/" done Mind also the quotes ...


1

The easiest and safest method would be to use find and tailor the command. E.g: find . -type f -name '*.gz' -exec bash -c 'n=$1; mv -- "$n" "${n%.*}"' _ {} \;


1

Following script might help: for i in $(ls) do mv $i ${i%.gz} 2> /dev/null done Basically it loops the files in directory and renames the files by removing 'gz' from the end.


1

Best compression ratio has also some important drawbacks and is often not recommended. For a backup solution it is often important to have a fast restore. You'll get best compression ratios when compressing your volume with a compression tool. xz seems to have best compression ratios: xz -z -c -9 -e /dev/sda2 > /path/file.xz Will compress your disk ...


1

SMBNetFS uses Gnome-keyring by default. Any passwords entered and saved in Gnome-keyring while browsing Samba shares in Nautilus should be used automatically. So if storing passwords in Gnome-keyring is OK, SMBNetFS is more convenient. It automatically mounts the entire network neighbourhood. This information is from the sample SMBNetFS config file, but I ...



Only top voted, non community-wiki answers of a minimum length are eligible