For example, We can set, javac command will list only java files on pressing tab key.
You are going to compile a java file(Begin.java) inside a directory named 'training', but the directory training contains some .class, .txt, and .conf files.
If you try to compile Begin.java using, javac
like wise, we can set for the below filetypes and applications.
gedit - .txt
java - .class
kview - .png,.jpg
Syntax:
complete -G '*.java' javac
complete -G '*.txt' gedit
complete -G '*.png' kview
complete -G '*.class" java
To list all the combinations:
Typing the command complete will list the added combinations.
complete
associations last only for the current bash session. If you exit and open a console, javac will no longer be associated with .java files. You need to associate file types to applications each time you start a new console session.
For permanent associations, you need to add the command to one of the bash startup scripts, such as ~/.bashrc. Then, whenever you are at the console, javac will be associated with .java files.
To revert: (complete -r
eg. complete -r javac
to remove all complete, type complete -r
No comments:
Post a Comment