Table of Contents
What is Bartib?
Install Bartib in Linux
Method 1: Installation via Homebrew
Install Homebrew
Install Bartib
Method 2: Installation via Cargo
Install Rust
Update Rust (if already installed):
Method 3: Installation via Precompiled Binaries
Install Bartib from AUR
Install Bartib in Alpine Linux
Test if Bartib has Been Installed Successfully
How to Track your Time in Linux using Bartib
Tell Bartib where to Save the Log of Your Activities
Simple Time Tracking: Starting and Stopping Activities
Listing Activities and Creating Reports
Changing Time Tracking Entries
Conclusion
Home System Tutorial LINUX How To Track Your Time In Linux With Bartib

How To Track Your Time In Linux With Bartib

Mar 17, 2025 am 10:32 AM

As IT professionals, we often need to track the time we spend on our assignments - whether it is for internal reporting in our company or for billing our clients. While many tools exist to fulfill different needs, many of them cater to bigger teams or special needs but lack the simplicity we enjoy when using command line tools. One simple tool, which allows us to track time directly on the command line is Bartib.

Table of Contents

What is Bartib?

Bartib provides several commands to track when we start and stop activities or to create reports on how much time we spent on certain tasks and projects. It saves a log of all tracked activities as a plain text file in a simple, human readable format.

Bartib is free and opensource application written in Rust.

Install Bartib in Linux

Bartib can be installed via Homebrew, the Cargo package manager, or by downloading precompiled binaries from the release page.

Method 1: Installation via Homebrew

Install Homebrew

If you have not yet installed Homebrew on your computer, please do so before proceeding:

  • Installation instructions for homebrew

Install Bartib

Once Homebrew is installed, Bartib can be installed using the following command:

$ brew install bartib
Copy after login

Method 2: Installation via Cargo

Install Rust

If Rust is not installed on your Linux machine, it needs to be installed before proceeding:

  • How To Install Rust Programming Language In Linux

Update Rust (if already installed):

Make sure you have the latest version of Rust by executing the following command:

$ rustup update
Copy after login

Install Bartib

Once Rust has been updated, you can proceed to install Bartib using the Cargo package manager. Execute the following command:

$ cargo install --locked bartib
Copy after login

Method 3: Installation via Precompiled Binaries

You can obtain a precompiled binary from the project's release page at the Bartib's Release Page. Download the tar file that corresponds with your architecture, extract it, and relocate the executable to a directory in your $PATH.

If you plan to use Bartib with your individual user account only, the directory might be ~/bin. However, if you intend to make Bartib available for all users on your device, the directory would be /usr/local/bin.

After installing Bartib, ensure that it's executable by setting the correct file permissions with the following command:

$ chmod 755 bartib
Copy after login

Alternatively, you have the option to install the pre-built binaries utilizing a shell script that you find on Bartib's release page. Just execute the following command, and the shell script will install Bartib straight to your system:

$ curl --proto '=https' --tlsv1.2 -LsSf https://github.com/nikolassv/bartib/releases/download/v1.1.0/bartib-installer.sh | sh
Copy after login

Install Bartib from AUR

If you're on Arch Linux and its variants like EndeavourOS and Manjaro Linux, you can install Bartib from Arch User Repository (AUR) using Paru:

$ paru -S bartib
Copy after login

Or Yay AUR helper:

$ yay -S bartib
Copy after login

Install Bartib in Alpine Linux

Bartib is available in the default repositories of Alpine Linux. You can install it using apk command like below:

$ sudo apk add bartib
Copy after login

Test if Bartib has Been Installed Successfully

After you have installed Bartib, you want to confirm that the installation was successful. Simply enter this command in your terminal, and it should present the installed version of Bartib:

$ bartib --version
Copy after login

How to Track your Time in Linux using Bartib

Tell Bartib where to Save the Log of Your Activities

As already mentioned above, Bartib records a log of all your activities in a plain text file. To be able to log any activity, Bartib must know where to locate this file. You designate the file explicitly in every command using the -f or --file flag, as follows:

$ bartib -f ~/activities.bartib report
Copy after login

Alternatively, Bartib permits to specify the file via the BARTIB_FILE environment variable. You should ideally define this variable in a file like .bashrc, which is executed in any shell you open, as such:

export BARTIB_FILE=activities.bartib
Copy after login

When the BARTIB_FILE environment variable is present, there's no need to employ the -f flag. As this method is the preferred way of specifying the file, the -f flag is disregarded in all of the subsequent examples.

Simple Time Tracking: Starting and Stopping Activities

You use Bartib by issuing the bartib command with a subcommand and optional parameters. In this regard it works much the same as other command line tools like git.

The subcommands you may need the most in your daily work are the start and stop command. As each activity in Bartib consist of a description and project, you have to define these as parameters with the start subcommand:

$ bartib start -d 'Fix javascript bug #345' -p 'Application Front End'
Copy after login

The -d or --description parameter sets the description, the -p or --project parameter sets the project.

After you have completed your task, you can stop tracking the time with:

$ bartib stop
Copy after login

You may also just start the next activity. Bartib will stop all running activities automatically when a new activity commences.

If you have been working for a while and are unsure if you have successfully started tracking your time, use the bartib current command to verify if bartib is tracking any activity and if so which. If you forgot to start the activity you can still start it later and set its start time using the -t parameter in 24 hour format:

$ bartib start -d 'Improve Database Performance' -p 'Housekeeping' -t 15:30
Copy after login

Two other command for starting activities come in handy, if you frequently switch between tasks. The first one is bartib last which displays a list of recently used combinations of descriptions and projects. The second one is bartib continue which allows you to continue any of these recent activities.

The output of bartib last shows an index for each activity in its first column:

How To Track Your Time In Linux With Bartib

You use this index with bartib continue to specify which activity to continue:

$ bartib continue 5
Started activity: "Team meeting" (Internal project) at 2024-05-17 18:03
Copy after login

You may also overwrite the description or the project by re-defining it by the respective parameter as well as set the start time with the -t parameter:

$ bartib continue 5 -d 'Fix Bug #56' -t 10:45
Copy after login

Listing Activities and Creating Reports

To list which activities you have tracked so far, use the list subcommand:

$ bartib list
Copy after login

How To Track Your Time In Linux With Bartib

It is often desirable to only list tasks in a certain period. You may define such a period with the --from and --to parameters:

$ bartib list --from 2024-05-13 --to 2024-05-17
Copy after login

If both dates are the same, you set them with a single --date argument:

$ bartib list --date 2024-05-15
Copy after login

Bartib provides several parameters to define often used time periods:

$ bartib list --today         # list todays' activities
$ bartib list --yesterday     # list yesterdays' activities
$ bartib list --current_week  # list activities of the current week (since monday)
$ bartib list --last_week     # list activities of the last week
Copy after login

It is often desirable to list all the activities you have tracked for a specific project. In this case, you can use the --project filter with bartib list:

$ bartib list --project 'Development of the Application Backend'
Copy after login

While it is helpful to be able to list all tracked activities, what makes Bartib truly useful is its ability to create meaningful reports.

Use the subcommand bartib report to create a report comprising all the activities you have ever tracked:

$ bartib report
Copy after login

How To Track Your Time In Linux With Bartib

As you see in the output above, Bartib lists all projects and under each project it provides a list of all activities belonging to this project. It displays the time that you have spent on each tasks and the total time that you have spent on each project. It also calculates the sum of all activities that you have ever tracked.

The bartib report command accepts the same parameters as bartib list to filter the tasks that it includes. Just as with bartib list, you use the --from and --to parameters to set a period for which you want to report, or you can use one of the predefined periods: --today, --yesterday, --current_week and --last_week.

Changing Time Tracking Entries

Sometimes, you might need to modify the activities that you have tracked. To alter the currently running activity, Bartib offers the bartib change command. Simply use it with the -p, -d or -t parameter to change its project, its description or its start time.

For example, the following command changes the start time of the currently running activity to 10:15:

$ bartib change -t 10:15
Copy after login

If you have already started tracking any activity but have changed your mind and do not wish to track anything at all, you can use the bartib cancel subcommand. It removes any currently tracked activity for good, while it won't touch any other activity in your log.

If you need to modify any activities that have already stopped, you can still alter its record in the activities log. Simply open the file in you favorite editor or use the bartib edit command to start the editor defined in your $EDITOR environment variable.

The format of a record is self-explanatory:

2024-05-13 10:15 - 2024-05-13 14:00 | Development of the Application Back end | Fixing the Logging endpoint
Copy after login

Each record consists of parts delimited by the pipe sign "|". The first part contains the start and end times, the second part the project and the third part the task description.

After you have manually altered the activities, you might want to use the bartib check and the bartib sanity command.

The former verifies whether the log contains any invalid lines that bartib won't be able to parse, while the latter checks whether the log contains any activities with logical errors, like an activity with a negative duration.

For detailed usage, check the Bartib GitHub repository:

  • Bartib GitHub Repository

Conclusion

As simple as Bartib is to use, it is a remarkably versatile tool for tracking activities on the command line. While it does not offer all the feature other tools provide, it is truly useful for anyone who wants to track times as a single user in a hassle-free way.


Related: Moro – A Command Line Productivity Tool For Tracking Work Hours


The above is the detailed content of How To Track Your Time In Linux With Bartib. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the Linux best used for? What is the Linux best used for? Apr 03, 2025 am 12:11 AM

Linux is best used as server management, embedded systems and desktop environments. 1) In server management, Linux is used to host websites, databases, and applications, providing stability and reliability. 2) In embedded systems, Linux is widely used in smart home and automotive electronic systems because of its flexibility and stability. 3) In the desktop environment, Linux provides rich applications and efficient performance.

What are the 5 basic components of Linux? What are the 5 basic components of Linux? Apr 06, 2025 am 12:05 AM

The five basic components of Linux are: 1. The kernel, managing hardware resources; 2. The system library, providing functions and services; 3. Shell, the interface for users to interact with the system; 4. The file system, storing and organizing data; 5. Applications, using system resources to implement functions.

What is basic Linux administration? What is basic Linux administration? Apr 02, 2025 pm 02:09 PM

Linux system management ensures the system stability, efficiency and security through configuration, monitoring and maintenance. 1. Master shell commands such as top and systemctl. 2. Use apt or yum to manage the software package. 3. Write automated scripts to improve efficiency. 4. Common debugging errors such as permission problems. 5. Optimize performance through monitoring tools.

How to learn Linux basics? How to learn Linux basics? Apr 10, 2025 am 09:32 AM

The methods for basic Linux learning from scratch include: 1. Understand the file system and command line interface, 2. Master basic commands such as ls, cd, mkdir, 3. Learn file operations, such as creating and editing files, 4. Explore advanced usage such as pipelines and grep commands, 5. Master debugging skills and performance optimization, 6. Continuously improve skills through practice and exploration.

What is the most use of Linux? What is the most use of Linux? Apr 09, 2025 am 12:02 AM

Linux is widely used in servers, embedded systems and desktop environments. 1) In the server field, Linux has become an ideal choice for hosting websites, databases and applications due to its stability and security. 2) In embedded systems, Linux is popular for its high customization and efficiency. 3) In the desktop environment, Linux provides a variety of desktop environments to meet the needs of different users.

What is a Linux device? What is a Linux device? Apr 05, 2025 am 12:04 AM

Linux devices are hardware devices running Linux operating systems, including servers, personal computers, smartphones and embedded systems. They take advantage of the power of Linux to perform various tasks such as website hosting and big data analytics.

What are the disadvantages of Linux? What are the disadvantages of Linux? Apr 08, 2025 am 12:01 AM

The disadvantages of Linux include user experience, software compatibility, hardware support, and learning curve. 1. The user experience is not as friendly as Windows or macOS, and it relies on the command line interface. 2. The software compatibility is not as good as other systems and lacks native versions of many commercial software. 3. Hardware support is not as comprehensive as Windows, and drivers may be compiled manually. 4. The learning curve is steep, and mastering command line operations requires time and patience.

Does the internet run on Linux? Does the internet run on Linux? Apr 14, 2025 am 12:03 AM

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

See all articles