Then, I came across the topic of aliases, which as the name suggests, provide alternative names for calling commands. For example, you can use 'dir' in place of 'ls' even though 'dir' is a DOS command. This is because the alias has been set up in .bashrc. I have added 2 aliases, which I will use as examples later, that go straight into the SD Card folder and into a sub-sub-folder in my SD Card folder.
- Press Ctrl-Alt-T to open the terminal console. You should be in /home/user.
- Backup your .bashrc in case things mess up. Type
"sudo cp /home/user/.bashrc /home/user/.bashrc.backup"
(In case you haven't noticed, filenames starting with '.' are hidden. To see them, type 'ls -la') - Open your .bashrc by typing "sudo nano /home/user/.bashrc".
- Go all the way to the bottom and add your aliases. This is what I have:
#special alias by Zion to change dir to SD Card
alias cdsd='cd /home/user/MMC-SD/SDHC4GB_Zn'
alias cdeee='cd /home/user/MMC-SD/SDHC4GB_Zn/Docs/asus-eee'
- Press Ctrl-O to save and Ctrl-X to exit.
- Type ". /home/user/.bashrc" or "source /home/user/.bashrc" to reload .bashrc.
- Now, whenever I type 'cdsd' at the command prompt, it will change to the SD Card folder. The same goes for 'cdeee' (without the quotes).
No comments:
Post a Comment