Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

The Complete Guide to Becoming a Web Developer: Part 6

Posted on Aug 6 • Originally published at nerdleveltech.com Welcome back to the series “Becoming a Web Developer” part 6. If you are new here, you can start with this list [ part 1, part 2, part 3, part 4, part 5]. In this part, we will discuss the Terminal and most used commands for web developers, and for more commands and details you can visit here.Now, If you're a web developer, software engineer, or just a tech enthusiast, you've probably used Linux commands and the terminal. But if you're not, let's get you to learn what are they, and why are they so important. Let's dive in!The terminal, also known as the Command line interface (CLI), is a tool that allows us to interact with our computer using text-based commands. It's a powerful tool that gives us direct access to the operating system and allows us to perform tasks more efficiently than we could with a graphical user interface (GUI).Linux commands are the language we use to communicate with the terminal. This originated in the Unix operating system but is now used in many other systems, including Linux and MacOS.So why should you, as a web developer or software engineer, care about Linux commands and the terminal? Here are a few reasons:In this article, we'll start with the basics and what you need to learn to start with Linux as a software developer or web developer.Before we dive into the commands and the terminal, let's take a moment to understand what's happening on the backend side of things. If you're new to web development, you might be wondering, In the context of web development, the 'backend' refers to the server side of an application. This is the part of the software that users don't see. It's where the magic happens: data is processed, stored, and sent back to the user. The backend is responsible for business logic, database interactions, server configuration, and much more.Imagine you're visiting an online store. The beautiful webpage you see, with all its images, buttons, and menus, is the 'front end.' It's what you interact with. But when you click on a product to view more details or place an order, your request is sent to the 'backend.' The backend retrieves the product details from the database or processes your order, then sends the information back to the frontend to be displayed to you.So, why is understanding the backend important for learning Linux commands and the terminal? Well, as a backend developer, or even a full-stack developer (someone who works on both the frontend and backend), you'll often find yourself working in a Unix-like environment. You'll need to navigate through your system's directories, manipulate files, install software, and run scripts, all using the terminal. That's why getting comfortable with Linux commands is such a crucial skill.In the following sections, we'll start exploring these commands, So, buckle up and get ready for an exciting journey!Getting comfortable with the terminal is a bit like learning to ride a bike. It might seem intimidating at first, but with practice, it becomes second nature. Here are some tips and strategies to help you become more comfortable with the terminal:1. Practice RegularlyThe best way to get comfortable with the terminal is to use it regularly. Try to incorporate it into your daily workflow. Need to create a new directory? Use mkdir. Need to move a file? Use mv. The more you use the terminal, the more familiar it will become.2. Learn the BasicsStart with the basic commands like ls, pwd, cd, mkdir, touch, rm, and cp. Understand what they do and practice using them. Once you're comfortable with the basics, you can move on to more advanced commands and concepts.3. Use the man CommandThe man command is your built-in manual. Use it to learn about other commands and their options. For example, man ls will show you the manual for the ls command, including a description of what it does and a list of its options.4. Don't Be Afraid to Make MistakesIt's okay to make mistakes. In fact, making mistakes is a great way to learn. If you type a command and it doesn't work, try to figure out why. Is there a typo in the command? Are you in the right directory? Did you forget an option?5. Customize Your TerminalCustomizing your terminal can make it more pleasant to use. You can change the colors, prompt, and even add features like auto-completion and command aliases. There are also different terminal emulators you can try, each with their own set of features.6. Learn to Use a Text EditorKnowing how to use a text editor from the terminal is a valuable skill. Whether it's Vim, Emacs, or Nano, choose one and learn the basics. You'll need this skill for editing configuration files, writing scripts, and more.7. Explore and Have FunFinally, don't forget to have fun. A terminal is a powerful tool, and learning to use it effectively can open up new possibilities. Try new commands, write scripts, and automate tasks. The more you explore, the more comfortable you'll become.Let's kick things off with two of the most basic yet essential Linux commands: ls and pwd. These commands are your bread and butter when it comes to navigating the terminal. They're the equivalent of looking around and checking your map in a new city.The ls command stands for 'list'. As the name suggests, it lists the contents of a directory. When you type ls into the terminal and hit enter, it will display all the files and directories in your current location.Here's an example:This example, ls has listed five directories: Desktop, Downloads, Pictures, Documents, and Music.As mentioned, ls lists the contents of a directory. But it can do much more when used with options. Let's look at some examples:ls -l: This option displays the contents in a 'long format', which includes additional information such as the file permissions, number of links, owner, group, size, and time of last modification.ls -a: This option shows all files, including hidden ones. In Unix-like systems, files that start with a dot (.) are hidden.ls -R: This option lists the contents of directories recursively, meaning it will show the contents of the directories within the current directory, and so on.The pwd command stands for 'print working directory'. It tells you where you currently are in your system's directory structure. Think of it as checking your current location on a map.Here's an example:In this example, pwd has printed the path to the current directory, which is the user's home directory.pwd -P: This option prints the physical directory, without any symbolic links. If you're in a directory that is a symbolic link (a file that points to another file or directory), pwd -P will show the actual directory, not the linked one.In this example, even if you navigated to the directory using a symbolic link, pwd -P shows the path to the actual directory.These two commands, ls and pwd, are your starting point for navigating the terminal. Practice using them until you're comfortable. In the next sections, we'll learn how to move around the directory structure and manipulate files. So, stay tuned!"P.S. Remember, you can always use the man command to read the manual and learn more about these commands and their options. For example, man ls will show the manual for the ls command.Changing directories is a fundamental task you'll do in the terminal. It's like navigating through folders in a graphical file explorer, but instead, you're using text commands. The command to change directories in Unix-based systems is cd, which stands for "change directory".Let's start with the basics. If you want to move into a directory, you type cd followed by the name of the directory. For example, if you have a directory named projects, you can move into it with:Now, what if you want to move back to the previous directory? You can use .. to represent the parent directory. So to move back, you can do:You can also use .. to move multiple levels up. For example, cd ../.. will move two levels up.If you want to go to your home directory, you can use the cd command without any arguments:You can also use ~ to represent your home directory. So cd ~ will also take you home.What about if you want to go to a specific directory, no matter where you currently are? You can do this by providing the absolute path to the directory. For example:This will take you to the directory /usr/local/bin, regardless of your current directory.Remember, the terminal is case-sensitive. So cd projects is different from cd Projects.Also, if the directory name has spaces, you need to enclose it in quotes. For example:Or you can escape the space with a backslash:A relative path is a path that starts from your current directory. It's 'relative' to where you are right now in the file system. For example, if you're in a directory called projects and there's a subdirectory in it called myapp, the relative path to myapp is simply:You can use this relative path with commands like cd to move into myapp.Relative paths can also use special directory names like . (which represents the current directory) and .. (which represents the parent directory).An absolute path, on the other hand, is a path that starts from the root of the file system. It's 'absolute' because it points to the same location, no matter where you currently are in the file system. An absolute path always starts with a /.For example, the absolute path to a directory myapp located directly under projects in your home directory might look something like the following. You also can use this absolute path with cd to go directly to myapp, no matter your current location:P.S. If you're moving around directories close to your current location, relative paths are simpler. If you're jumping to a directory far from your current location, absolute paths can be more direct.Creating new directories (or folders) is a common task when organizing your files or setting up new projects. In the terminal, you can create directories using the mkdir command, which stands for 'make directory'.The basic usage of mkdir is straightforward. Just type mkdir followed by the name of the directory you want to create. For example, to create a directory named myproject, you would use:This will create a new directory named myproject in your current directory. You can verify that the directory was created using the ls command:If myproject was created successfully, you should see it listed in the output of ls.You can also create a directory in a different location by specifying a path. For example, to create a directory named myproject in the projects directory, you would use:This assumes that the projects directory already exists. If it doesn't, mkdir will give an error. However, you can tell mkdir to create any necessary parent directories by using the -p option:This will create both projects and myproject if they don't already exist.The touch command is a standard command used in UNIX/Linux operating system which is used to create, change and modify timestamps of a file.Let's say you want to create a new file named 'example.txt'. You can do this using the touch command like so:If the file 'example.txt' does not already exist, the touch command will create a new file with this name. If the file already exists, touch will update the last-modified time of the file.The rm and rmdir commands are used to remove files and directories respectively.The rm command removes specified files. For example, to remove a file named 'example.txt', you would use the rm command like this:Be careful when using rm, as it deletes files permanently. It's not like moving a file to the trash bin, it's more like shredding that file!The rmdir command removes empty directories. To remove a directory, it must be empty of files and other directories. Here's how you would remove a directory named 'example_directory':If you want to remove a directory and its contents, you can use the rm command with the -r (or --recursive) flag. This tells rm to remove the directory and its contents recursively. Be very careful when using this command, as it will permanently delete the directory and everything within it:In summary, touch is used to create or update files, rm is used to remove files and directories, and rmdir is used to remove empty directories.We've taken quite a journey through the world of Linux commands and the terminal. We started with the basics, learning about commands like ls and pwd, and then moved on to making directories, removing files, and understanding man pages and flags. We've also discussed some common mistakes and best practices to keep in mind when working with the terminal.Remember, don't be discouraged if you don't remember all the commands or concepts right away. Keep practicing, keep experimenting, and before you know it, you'll be wielding the terminal like a pro.For those of you who are eager to continue your journey with Linux commands and the terminal, here are some additional resources that you might find helpful:Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse Muhammad A Faishal - Jul 27 Sadeedpv - Jul 30 Andrew Baisden - Jul 19 Karen Payne - Jul 3 Once suspended, aradwan20 will not be able to comment or publish posts until their suspension is removed. Once unsuspended, aradwan20 will be able to comment and publish posts again. Once unpublished, all posts by aradwan20 will become hidden and only accessible to themselves. If aradwan20 is not suspended, they can still re-publish their posts from their dashboard. Note: Once unpublished, this post will become invisible to the public and only accessible to Ahmed Radwan. They can still re-publish the post if they are not suspended. Thanks for keeping DEV Community safe. Here is what you can do to flag aradwan20: aradwan20 consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy. Unflagging aradwan20 will restore default visibility to their posts. DEV Community — A constructive and inclusive social network for software developers. With you every step of your journey. Built on Forem — the open source software that powers DEV and other inclusive communities.Made with love and Ruby on Rails. DEV Community © 2016 - 2023. We're a place where coders share, stay up-to-date and grow their careers.



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

The Complete Guide to Becoming a Web Developer: Part 6

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×