Renaming/moving files with suffixes quickly:
cp /home/foo/realllylongname.cpp{,-old}
This expands to:
cp /home/foo/realllylongname.cpp /home/foo/realllylongname.cpp-old
Just to point out that to do the reverse (going from .cpp-old to .cpp) you’d do
cp /home/foo/realllylongname.cpp{-old,}
Repeats your last command
!!
Most useful in the form:
sudo !!
‘^string^string2’ which takes the last command, replaces string with string2 and executes it
sodu apt-install java
^sodu^sudo
rename
$ ls
this_has_text_to_find_1.txt
this_has_text_to_find_2.txt
this_has_text_to_find_3.txt
this_has_text_to_find_4.txt
$ rename 's/text_to_find/been_renamed/' *.txt
$ ls
this_has_been_renamed_1.txt
this_has_been_renamed_2.txt
this_has_been_renamed_3.txt
this_has_been_renamed_4.txt
How to list only subdirectories in the current one ?
ls -d */