Introduction to Bash, VIM & Regex Introducting Aliases
Transcript from the "Introducting Aliases" Lesson
>> James Halliday: Some of my favorite switches for LS are -1, which is really useful for scripts which makes sure that all of the files are in a single column. So you can sort of process them line by line instead of having to parse the column format.
>> James Halliday: It can also do things like
>> James Halliday: -F, capital F, and --color=auto. I don't know if this will work on Mac with BSD version LS, but on Linux, it's a pretty good version of LS. It gives you things like colors and it provides the, like if there's a slash on the end of this directory, so you can sort of tell things apart.
>> James Halliday: All of these options are documented in the min page, it's called for-
>> Speaker 2: Can you go back to your aliases? That's actually really interesting.
>> James Halliday: Yeah, I've got all kinds of fun stuff in there. [LAUGH]
>> James Halliday: I don't know why I have an Emacs alias. I never use that.
>> James Halliday: There's my tslide alias that turns of the syntax highlighting.
>> Speaker 2: Someone's asking how do I exit the man command?
>> James Halliday: Q.
>> Speaker 2: Will we go into creating aliases?
>> James Halliday: I forget if I put it in the notes, but we can do that. I'll could show you right now.
[00:01:59] If you have a command that you want to run in a custom way, you can use an alias. If I wanna create an alias for the OS commands, that is like ls -1. If I only want to see column output, I can do that with quotes. LS thinks I always see them line by line.
[00:02:22] You can do this with pretty much any command, including composing commands.
>> Speaker 2: Then lets say you wanted to remove that?
>> James Halliday: So in this case, you can just close the shell and open it again, cuz I didn't save it anywhere, so ls is back to its default behavior.
[00:02:38] If you want to save your aliases you can use one of your rc files. So if you open ~/.bashrc, and I'm gonna go into more about what the tilde means, and what the dot file means, then you can set up aliases in there. So this is an example of a bash script, which we're gonna be talking a lot more about once we have learned some more commands.
[00:03:05] So you can put your aliases in there.