How do I find out if a file is more than one hour old in a UNIX shell and take action on all matching file such as delete or move files.
use vi / vim as IDE (Integrated development environment) a software development system using Ubuntu Linux. How do I auto complete file name under vim / vi text editor while editing text file or java / c / python program? I can auto complete file nameunder bash shell by hitting [TAB] key.
Q. I’ve backup created using rsync command stored at /disk2/home/tom/ directory. Accidentally, I had deleted files from /home/tom directory. I’d like to restore all file names starting with alpha numeric characters from /disk2/home/tom/ to /home/tom. How do I restore selected files in a batch mode?
Continue reading “Restore Selected Files From Secondary Backup Hard Disk”
Q. Iâ€™m using BASH shell filename tab completion feature to complete file names and other stuff. However default tab-completion in bash case-sensitive. It cannot show me /tmp/Y* or /tmp/Y* files. How do I force filename tab-completion in bash case insensitive?
A. According to bash man page completion-ignore-case set to Off. If set to On, readline performs filename matching and completion in a case-insensitive fashion. Readline has variables that can be used to further customize its behavior. A variable may be set in the /etc/inputrc file with a statement of the form. So all you have to do is type following command:
$ set completion-ignore-case on
You need to add set completion-ignore-case on to /etc/inputrc command:
Append text as follows:
set completion-ignore-case on
Close and save the file. For more information read bash man page.
Q. Can you specify rules for naming a file name under Linux?
A. When you save a data, you nee to select a file name, you need to follow certain rules and regulation regarding the length of the name and the types of characters you include.
Rules for naming file names
The rules for naming a file names under Linux (and UNIX like oses) are as follows:
[a] The file names can be up to 255 characters (or bytes) long
[b] You cannot use all special characters, try to use:
=> Uppercase or lowercase letters
=> Special characters, such as: +, -, _, .
[c] File names are case-sensitive. Thus, the following file names all are different:
vivek Vivek VIVEK VIVek
[d] Try to avoid non printable and following characters in filenames:
/, >, <, ?, “, ‘, blank space
How do I show hidden files?
Use ls -a or ls -la command:
$ ls -la
$ ls -a
Use -a to see invisible file names.
How do I access filenames with spaces?
To access a filename with spaces, enclose the filename in quotes:
$ cat "my bio data.txt"
$ cd "a long dir nane"
Please note that above rules almost apply to other UNIX like operating system such as HP-UX, Solaris, FreeBSD etc.
How do I search for file in Bash?