Importance of Command Line Basics
Recently I had to work with a client who was a Mac user and I'm a Windows type of a bloke. I accessed the client's machine over remote desktop, for a practical tutoring lesson on how to setup and use build tools. It took me by surprise, a bit, when I saw that he was using Mac OS X I though I might embarrass myself , but then I remembered that real ninjas don't panic so I just opened up the terminal, instead of poking around the file explorer (File Finder I believe it's called on Mac).
After that it was mostly smooth sailing. I've been using Unix commands via Git Bash on Windows for a quite a while and it sure has paid off. There are plenty of operating systems out there and each has their own unique Graphical User Interface and it's hard to know your way around all of them. One of the advantages of knowing the command line is that is it's an universal tool, especially Unix commands, same command will work on both Linux and Mac. Unix command line can be also used on Windows, with tools like Git Bash, or even natively by using Windows PowerShell. Unless you're still using Windows 98...
Command line can seems scary and overwhelming at first, but as developers we don't need to learn all of the commands, just a small portion, like moving around the file system, making new directories and files, recriminating and deleting, to name a few. Even when it comes to custom CLI's most of the time you'll be using maybe 10-20% of the available commands. Obviously administrators and dev ops people need to know more commands by hearth, but developers have it easy, most of the time.
Bellow is a list of most commonly used commands, thanks for stopping by.
Command | Description |
---|---|
ls | Lists all files and directories in the present working directory |
ls - R | Lists files in sub-directories as well |
ls - a | Lists hidden files as well |
ls - al | Lists files and directories with detailed information like permissions, size, owner, etc. |
cat > filename | Creates a new file |
cat filename | Displays the file content |
cat file file2 > file3 | Joins two files (file1, file2) and stores the output in a new file (file3) |
mv file "new file path" | Moves the files to the new location |
mv filename new_file_name | Renames the file to a new filename |
sudo | Allows regular users to run programs with the security privileges of the superuser or root |
rm | Deletes a file |
man | Gives help information on a command |
history | Gives a list of all past commands typed in the current terminal session |
clear | Clears the terminal |
mkdir | Creates a new directory in the present working directory |
mkdir | Create a new directory at the specified path |
rmdir | Deletes a directory |
mv | Renames a directory |
pr -x | Divides the file into x columns |
pr -h | Assigns a header to the file |
pr -n | Denotes the file with Line Numbers |
lp -nc lpr c | Prints "c" copies of the File |
lp -d | Specifies name of the printer |
apt-get | Command used to install and update packages |
mail -s 'subject' -c 'cc-address' -b 'bcc-address' 'to-address' | Command to send email |
mail -s "Subject" to-address < Filename | Command to send email with attachment |
Comments
Post a Comment