In a large web application, the backend logs can get quite verbose: requests created, sent, processed, received, etc. The list can grow large very quickly depending on how logs are implemented. You can check the logs from a Docker container using docker logs, no need to exec into the container: docker logs <container_id> You can … Continue reading Sending docker container logs to a separate file
Tag: command line
Command line shortcuts
I normally don't use many shortcuts because it's easier to just use my arrows and mouse to navigate than to memorize shortcuts but I am slowly realizing that the time spent on learning a new shortcut pays off. However, my memory is not that great and if I try to memorize multiple things at once, … Continue reading Command line shortcuts
Add a filename in the command line when running a Python script
OR: Run a Python script with arguments You can add arguments to the command line when running python scripts by importing the sys module from Python's standard library and using its argv function. Some examples: A simple script that displays the user name: def main(): name = 'Frodo' print(f'Hello, {name}') if __name__ == "__main__": main() … Continue reading Add a filename in the command line when running a Python script
Customize your terminal prompt with colors
NOTE: the steps below assumes you have a Bash shell. If you are using a Unix machine (Mac or Linux) and are not sure what type oh shell you have, it's probably Bash. In most systems, by default, the prompt in the terminal (or command window) displays the hostname and the working directory but this … Continue reading Customize your terminal prompt with colors
Check which commands you typed in the command line and don’t repeat yourself!
Recently I needed to repeat a series of long~ish commands in the command line but I never quite memorized them so I ended up resourcing to arrow-up-arrow-up-arrow-up </ad nauseum> until I found the command I was looking for. But there is a better and super simple way: history Typing history in the command line will … Continue reading Check which commands you typed in the command line and don’t repeat yourself!
Docker for development: make local files visible to a container with volume mapping
I wrote a very simple right-to-the-point Docker introduction post if you're new to Docker. If you want to see your code changes applied right away to a running Docker container, you need to make sure to run the container using the share volumes tag: -v (or --volume). The -v tag expects as a parameter the … Continue reading Docker for development: make local files visible to a container with volume mapping
Docker: most used Docker commands
Docker has been around for a few years but it sounded too complicated and I never knew exactly what problem it was solving. Only recently I learned about it and started using Docker both at work and on my personal projects. I started writing a post explaining some few basic stuff about Docker but it … Continue reading Docker: most used Docker commands