Basic Useful Commands for Developers Using an Apache Server

Basic Useful Commands for Developers

File and Directory Management

  1. chmod: Change file or directory permissions.

    chmod 755 myfile
    
  2. mkdir: Create a new directory.

    mkdir mydirectory
    
  3. rm: Remove files or directories.

    rm myfile
    
  4. cp: Copy files or directories.

    cp source destination
    
  5. mv: Move or rename files or directories.

    mv oldname newname
    
  6. touch: Create an empty file or update the timestamp of an existing file.

    touch newfile
    
  7. cat: Display the contents of a file.

    cat myfile
    
  8. less: View the contents of a file one page at a time.

    less myfile
    
  9. find: Search for files in a directory hierarchy.

    find /path -name filename
    
  10. grep: Search for a specific pattern within files.

    grep "pattern" filename
    

Composer Commands

  1. composer install: Install project dependencies from composer.json.

    composer install
    
  2. composer update: Update project dependencies to the latest versions.

    composer update
    
  3. composer require: Add a new package to your project.

    composer require vendor/package
    
  4. composer dump-autoload: Regenerate the list of all classes that need to be included in the project.

    composer dump-autoload
    

MySQL Commands

  1. Import Database: Import a database from a file.

    mysql -u username -p database_name < file.sql
    
  2. Export Database: Export a database to a file.

    mysqldump -u username -p database_name > file.sql
    
  3. Show Databases: List all databases on the server.

    SHOW DATABASES;
    
  4. Show Tables: List all tables in the selected database.

    SHOW TABLES;
    
  5. Describe Table: Show the structure of a table.

    DESCRIBE table_name;
    

GitHub Commands

  1. Clone Repository: Clone a remote repository to your local machine.

    git clone https://github.com/user/repo.git
    
  2. Commit Changes: Commit staged changes with a message.

    git commit -m "Commit message"
    
  3. Push Changes: Push local commits to a remote repository.

    git push origin branch_name
    
  4. Pull Changes: Fetch and merge changes from a remote repository.

    git pull origin branch_name
    
  5. Create Branch: Create a new branch.

    git checkout -b new_branch_name
    
  6. Merge Branch: Merge a branch into the current branch.

    git merge branch_name
    

Homebrew Commands (macOS)

  1. Install Package: Install a new package using Homebrew.

    brew install package_name
    
  2. Update Homebrew: Update Homebrew to the latest version.

    brew update
    
  3. Upgrade Packages: Upgrade all installed packages to their latest versions.

    brew upgrade
    
  4. Search Package: Search for a package in Homebrew.

    brew search package_name
    

Apache Server Commands

  1. Start Apache: Start the Apache server.

    sudo service apache2 start
    
  2. Stop Apache: Stop the Apache server.

    sudo service apache2 stop
    
  3. Restart Apache: Restart the Apache server.

    sudo service apache2 restart
    
  4. Check Apache Status: Check the status of the Apache server.

    sudo service apache2 status
    
  5. Edit Apache Configuration: Edit the Apache configuration file.

    sudo nano /etc/apache2/apache2.conf
    
  6. Enable Apache Module: Enable a specific Apache module.

    sudo a2enmod module_name
    
  7. Disable Apache Module: Disable a specific Apache module.

    sudo a2dismod module_name
    

Additional Useful Commands

  1. ls: List files and directories in the current directory.

    ls -la
    
  2. cd: Change the current directory.

    cd /path/to/directory
    
  3. curl: Transfer data from or to a server.

    curl http://example.com
    
  4. nano: Edit files using the nano text editor.

    nano filename
    
  5. wget: Download files from the web.

    wget http://example.com/file.zip
    
  6. tar: Archive files into a tarball or extract a tarball.

    tar -czvf archive.tar.gz directory/
    tar -xzvf archive.tar.gz
    
  7. zip: Compress files into a zip archive.

    zip -r archive.zip directory/
    
  8. unzip: Extract files from a zip archive.

    unzip archive.zip
    

Conclusion

These commands are fundamental for managing your development environment, especially when working with an Apache server. By mastering these commands, you can efficiently handle file management, dependency management, database operations, and more. Practice using these commands to streamline your development workflow and improve productivity.

References

  • Tags:

Share this:

user

Author: Manish Kumar

I've been working with PHP for over 11 years and focusing on Laravel for the last 6 years. During this time, I've taken part in big projects and gotten to know tools like Laravel Livewire really well. Besides working on projects, I enjoy writing about Laravel on LinkedIn and Medium to share what I've learned. I'm always looking to learn more and share my knowledge with others. Right now, I'm diving into new areas like using Docker to make web apps run better and exploring how to build them using microservices. My goal is to keep learning and help others do the same in the world of web development.

Leave a reply

dot

Subscribe to Newsletter

Provide your email to get email notification when we launch new products or publish new articles

Newsletter

Subscribe to my newsletter to get updated posts

Don't worry, I don't spam