Know your tools

Last updated on
28 December 2025

This documentation is deprecated.

Knowing the toolset you use can make you develop web applications better and more efficiently. Investing time to get a deeper understanding of them is usually well spent.

Basic command-line commands

The popularity of the terminal or command-line interface (CLI) is explained by the fact that you can count on it being available on any system and the results of the commands being predictable. Despite novice developers might initially find it a bit awkward and tend to stick to their graphical user interface applications, once they start to interact with a remote server through SSH or find solutions to their problems on the internet fora using CLI commands, they usually gradually start to use it more.

Your system comes with a set of Linux/Unix Commands that are mainly used for file management. Whenever you run a command, it executes the corresponding program code, written for the command. Press Ctrl-Alt-T to open the terminal to use them.

There is such an overwhelming amount of good resources available online that it is suggested to do a Google search.

For most commands, you can get detailed instructions using man [command], for example, man mkdir will result in:

NAME
       mkdir - make directories

SYNOPSIS
       mkdir [OPTION]... DIRECTORY...

DESCRIPTION
       Create the DIRECTORY(ies), if they do not already exist.

       Mandatory arguments to long options are mandatory for short options too.

       -m, --mode=MODE
              set file mode (as in chmod), not a=rwx - umask

       -p, --parents
              no error if existing, make parent directories as needed

       -v, --verbose
              print a message for each created directory

       -Z     set SELinux security context of each created directory to the default type

       --context[=CTX]
              like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX

       --help display this help and exit

       --version
              output version information and exit

AUTHOR
       Written by David MacKenzie.

REPORTING BUGS
       GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
       Report mkdir translation bugs to <http://translationproject.org/team/>

COPYRIGHT
       Copyright © 2017 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
       This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       mkdir(2)

       Full documentation at: <http://www.gnu.org/software/coreutils/mkdir>
       or available locally via: info '(coreutils) mkdir invocation'

You can even save it in a file, for example using man mkdir > man_mkdir.txt.

When someone else shows you a series of commands to accomplish something, see what they did after by listing the latest commands with history.

An A-Z Index of the Linux command line | SS64.com

Useful .bashrc scripts

Add snippets to your .bashrc file to extend its functionality.

All three of the above in one snippet

Open your terminal editor:

nano ~/.bashrc

Then add to the bottom of it:

# Bash history without line numbers.
alias history="history | sed 's/^[ ]*[0-9]\+[ ]*//'"

# Show the git branch in color.
force_color_prompt=yes
color_prompt=yes
parse_git_branch() {
 git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
else
 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
fi
unset color_prompt force_color_prompt

# List files and directories with octal (three-digit numerical) permissions.
lso() { ls -alG "$@" --color | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(" %0o ",k);print}'; }

Remember to reload bash:

source ~/.bashrc

An example of the result:

The other command-line tools

Other Command Line tools you already should have if you did the previous part of this guide are Composer, Git, Drush and Drupal (Console). For each of them, you have a manual already provided for each command. See a list of available commands just by typing the tool name (composer, git, drush, drupal) followed by list or help (for git). For example composer list results in:

martin@martin-XPS-13-9370 /var/www/html/grey.localhost (develop=) $ composer list
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.7.2 2018-08-16 16:57:12

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  about                     Shows the short information about Composer.
  archive                   Creates an archive of this composer package.
  browse                    Opens the package's repository URL or homepage in your browser.
  check-platform-reqs       Check that platform requirements are satisfied.
  clear-cache               Clears composer's internal package cache.
  clearcache                Clears composer's internal package cache.
  config                    Sets config options.
  create-project            Creates new project from a package into given directory.
  depends                   Shows which packages cause the given package to be installed.
  diagnose                  Diagnoses the system to identify common errors.
  dump-autoload             Dumps the autoloader.
  dumpautoload              Dumps the autoloader.
  exec                      Executes a vendored binary/script.
  global                    Allows running commands in the global composer dir ($COMPOSER_HOME).
  help                      Displays help for a command
  home                      Opens the package's repository URL or homepage in your browser.
  i                         Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
  info                      Shows information about packages.
  init                      Creates a basic composer.json file in current directory.
  install                   Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
  licenses                  Shows information about licenses of dependencies.
  list                      Lists commands
  outdated                  Shows a list of installed packages that have updates available, including their latest version.
  post-drupal-scaffold-cmd  Runs the post-drupal-scaffold-cmd script as defined in composer.json.
  prohibits                 Shows which packages prevent the given package from being installed.
  remove                    Removes a package from the require or require-dev.
  require                   Adds required packages to your composer.json and installs them.
  run-script                Runs the scripts defined in composer.json.
  search                    Searches for packages.
  self-update               Updates composer.phar to the latest version.
  selfupdate                Updates composer.phar to the latest version.
  show                      Shows information about packages.
  status                    Shows a list of locally modified packages, for packages installed from source.
  suggests                  Shows package suggestions.
  u                         Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
  update                    Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
  upgrade                   Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.
  validate                  Validates a composer.json and composer.lock.
  why                       Shows which packages cause the given package to be installed.
  why-not                   Shows which packages prevent the given package from being installed.
 drupal
  drupal:scaffold           Update the Drupal scaffold files.

Now, try yourself with another tool name (gitdrush or drupal). Make sure you can run them without the .vendor/.. prefix by using the Drush Launcher and Drupal Console Launcher.

To have more detailed instructions for a single command, then use [tool name] help [command]. For example composer help why results in:

martin@martin-XPS-13-9370 /var/www/html/grey.localhost (develop=) $ composer help why

Usage:
  depends [options] [--] <package> [<constraint>]
  why

Arguments:
  package                        Package to inspect
  constraint                     Optional version constraint [default: "*"]

Options:
  -r, --recursive                Recursively resolves up to the root package
  -t, --tree                     Prints the results as a nested tree
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  Displays detailed information about where a package is referenced.
  
  php composer.phar depends composer/composer

Now, try yourself with another command.

Additionally, for Drush you have a bunch of documentation available from the command line:

martin@martin-XPS-13-9370 /var/www/html/yellow.localhost $ drush docs
                                                                                                                       
  Command "docs" is ambiguous.                                                                                         
  Did you mean one of these?                                                                                           
      docs:output-formats-filters Output formatters and filters: how to control the output produced by Drush commands  
      docs:readme                 README.md                                                                            
      docs:bisect                 Drush's support for Git Bisect.                                                      
      docs:bashrc                 Bashrc customization examples for Drush.                                             
      docs:configuration          Configuration overview with examples from example.drush.yml.                         
      docs:config:exporting       Drupal config export instructions, including customizing config by environment.      
      docs:aliases                Creating site aliases for running Drush on remote sites.                             
      docs:bootstrap              Bootstrap explanation: how Drush starts up and prepares the Drupal environment.      
      docs:cron                   Crontab instructions for running your Drupal cron tasks via `drush cron`.            
      docs:commands               Instructions on creating your own Drush commands.                                    
      docs:generators             Instructions on creating your own Drush Generators.                                  
      docs:examplecommand         Example Drush command file.                                                          
      docs:example-sync-via-http  Extend sql-sync to allow transfer of the sql dump file via http.                     
      docs:policy                 Example policy file.                                                                 
      docs:repl                   Drush's PHP Shell.

Just try one of them, for example drush docs:configuration.

Shell scripting

Many of the system-related tasks that can be automated are done with shell scripts. Think of a Git hook mentioned in the previous chapter that performs a series of tasks, for example before a commit or after a merge. Having some knowledge of Shell makes it less intimidating and makes your workflow more efficient.

The command-line toolset (including Git, Composer, Drush, and Drupal Console) may seem awkward to use but give a tremendous amount of flexibility. Putting it into a script facilitates the repetitive use of common tasks. To get an idea of the power, check out the more advanced commands:

As you might have noticed, regular expressions are used in many program languages and also in Shell. In general, the best time investment is usually studying techniques that are used in multiple programming languages. Not only because you can reuse them but also because it is more likely they stick around for many years to come. Learning Regex is a good example.

The Chrome browser inspector

The browser inspector is another tool you already have because it comes with the browser that you use. It is used extensively by practically all web developers to inspect and debug anything that can be shown in a web browser. The most popular is the one that ships with Google Chrome. It can be accessed by pressing F12 when on any page.

Read Chrome DevTools |  Tools for Web Developers |  Google Developers for more info on all features.

Tip: Sass Source Maps + Chrome = Magic

Browser extensions

Most common use cases as a source of inspiration to start a web search. Links are given for authoritative tools.

  • Create dummy content, like Lorem Ipsum text.
  • Check elements on existing pages, like a color picker, getting sizes or see what fonts have been used. 
  • Pretty print raw data to make it human-readable, for example, JSON endpoints.
  • Aid in API development with Postman. Read more at the POSTMAN Learning Center.
  • LiveReload, so that CSS edits apply immediately.
  • Xdebug helper

IDE or code editor

PhpStorm

Sublime Text 3

Repository management service

Because you likely interact with it from your local machine on a daily basis, it makes sense to read the appropriate documentation on it.

Automated Testing Tools

Based on the criteria being multi-platform and having a free license available that allows for all of the features in an unlimited way:

Online tools

As an example, to write more complex regular expressions testing it with an online regex tester is indispensable. Other common uses of online tools are converters, for example, going from one format to another (JSON to YAML).


Next: Troubleshooting and other resources >>

Help improve this page

Page status: Deprecated

You can: