It's time for some more Linux terminal-fu! So last time on HakTip I checked out a few simple commands- cd for changing the directory and ls to list files to name a few. This week, lets delve a little deeper, shall we? I'm pretty new to the Linux side of things but after years of using Windows, I'm branching out and teaching myself how to use this awesome OS. Back to the terminal- So when I list my files, if I want to see what kind of file types they are, I can type file pic and it'll show me the file information. Then there is a built in program called less. Less lets you view text files in the terminal by typing less filename.
While in the less program, you can use some other commands to move around. (less --help). There are several built in programs similar to less that make it easier to use the Terminal, and this is just one of the many you can choose from. Now that you know how to move around and view text files, you have the ability to explore your Linux system in more depth! We'll check out a bit of file manipulation after the break.
Let's manipulate some files. We can move, copy, remove and rename files/directories, and we can also make directories as well. We already know how to make a directory with mkdir directoryname. I want to copy this photo into my new directory, so I would type cp pic folder1, or I can type cp pic pic1 to create a copy in the same folder. Remember, you can type --help to find all the other options for copy.
If you want to move a file, type mv file1 file2 and you can also move the file to another directory by typing mv pic Documents. If you want to remove a file or directory, type rm pic, but be careful! If you want to use a wildcard, like an asterisk (*), for example to delete all .jpg, you could type rm *.jpg. Don't put a space between * and .jpg, or the rm command will try to delete everything, then tell you there isn't any file called .jpg. Next time on HakTip I'll talk a little more about wildcards, and discuss what the heck it means to create links.
How did you learn the terminal? There are lots of handy websites out there that go really into detail about how to use it. Tell me about your favorites in the comments or email me at email@example.com. And be sure to check out our sister show, Hak5 for more great stuff just like this. I'll be there, reminding you to trust your technolust.