Top Linux Commands
A Web Developer Must Know – Part 1

There’s a lot more to being an open source web developer than just building apps in an IDE. You need to have a basic knowledge of the Linux command line. Whether you’re using PHP, Python, Perl, C/C++, Vue JS, or even basic HTML & JavaScript. You’re going to need to know your way around the Linux command line.

Here’s a list of the top linux commands you need to know beginning your career in web development:

1. SSH ( Secure Shell )

The first thing you’ll need to know is how to connect to the command line and connect to other servers. SSH is the way this is done.

derek@codes $ ssh username@the.servername.com

The first time you connect to a server you’ll receive a warning about adding the host to your list of known_hosts. Hit enter to accept.

2. LS ( List )

Listing files is essential. Here’s a few of the most commonly used list command uses to show files / folders in the current directory, show files / folders in a vertical list format, and show all files including hidden files in a vertical list format. 

derek@codes $ ls
derek@codes $ ls -l
derek@codes $ ls -la

3. CD ( Change Directory )

Changing directories is easy to do with the “cd” command. Here are examples of the most common uses. 

derek@codes $ cd path_to_folder/

Will move you back one directory. 

derek@codes $ cd ..

Will change directories to your home directory. 

derek@codes $ cd

4. PWD ( Working Directory ) 

Knowing where you are is really important when uploading & moving files or including scripts in your code. This command shows you exactly where you are in the folder structure. 

derek@codes $ pwd
/home/derek/www/example-laravel-project/app/Models/

5. RM ( Remove )

This one is fairly self explanatory, removing files is something you’ll most definitely need to do regularly.

Removing a single file:

derek@codes $ rm file_to_remove.txt

Remove a folder structure recursively – forcing the removal so it doesn’t prompt you if something doesn’t exist:

derek@codes $ rm -rf file_to_remove.txt

6. CP ( Copy )

There’s a few different ways to copy files in Linux. Here’s the most common situations:

Copying a single file:

derek@codes $ cp file_to_copy.txt new_file.txt

Copying an entire folder structure using the archive attribute:

derek@codes $ cp -a folder_to_copy/ new_folder_name/

7. MV ( Move )

Moving files in Linux is very similar to copying however, you don’t need the “-a” ( archive ) attribute to move folder structures:

derek@codes $ mv file_to_move.txt new_file.txt
derek@codes $ mv folder_to_move/ new_folder_name/

Bonus ( Auto Completion )

Pressing the Tab key will reveal auto completion suggestions based on where you are in the folder structure. For example, tap the Tab key while listing a directory:

derek@codes $ ls path_to_list/

Or tap the Tab key while completing a command to reveal all the commands that start with your text:

derek@codes $ ss

Conclusion

Watch me walk through all of these commands in action on my YouTube Channel:

Happy Coding!

~ Derek Codes

Share via
Copy link
Powered by Social Snap