From the course: Linux: Bash Shell and Scripts

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Time commands and set variables

Time commands and set variables - Linux Tutorial

From the course: Linux: Bash Shell and Scripts

Start my 1-month free trial

Time commands and set variables

- [Presenter] Bash has builtin commands. One of my favorite is the time command because I'm always interested in how long something takes to run. With the time command, you can say time and then another command. When that command finishes, (mumbles) will report how long it took. The real line is how long it took in real time like if you had timed it with a stop watch. User and sys are CPU times. So how much time the program was actually processing, not sleeping, say, or getting preempted by other processes. And user was time or instructions in the program itself, and sys was time or instructions in the operating system, in the kernel doing something for that process. Usually, real time is what might be interesting. If we're gonna write programs, we need variables. Variables in Bash, you assign a value with equal sign. One of the important things with Bash is no spaces before or after the equal sign. If the value you want to assign to the variable has any special characters in it like…

Contents