at Command in Linux

Learn via video courses
Topics Covered

Build an AI-First Career, Master the Complete Skillset

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program
NSDC Certified

AI Forward Deployed Engineer Program

Full-stack engineering, production AI and client-facing consulting

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program

Overview

The 'at' command in Linux is a powerful tool that allows users to schedule tasks to be executed at a later time. This is extremely useful when you have certain tasks that need to be run at specific times. With the 'at' command, you can schedule these tasks without needing to be present or even logged in.

Syntax of at Command in Linux

The basic syntax of the at command in Linux is as follows:

Where:

  • at: This is the actual 'at' command itself that initiates the scheduling of tasks.
  • TIME: This specifies when the task will be executed. You can enter a specific time, or use a string like 'now + 1 hour'.
  • Task: The actual task to be performed. This can be any command that could normally be entered at the command line.
Sharpen Your Fundamentals with Free Learning

Options in at Command in Linux

  1. -V: Prints the version number of 'at' command to the terminal.

    For example -

    Output:

    This command will display the version of the 'at' command that is currently installed.

  2. -q: This option is used to specify a particular queue. The 'at' command will add the task to this queue.

    For example -

    Output:

    This command will schedule the 'echo hello' command to run one minute from now, and add it to queue 'b'.

  3. -f: Read the job from the given file, rather than standard input.

    For example -

    Output:

    This command will schedule the 'script.sh' to run one hour from now.

How Scaler Transformed Careers in Different Fields

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Example Usages

  • Basic use of 'at' command to schedule a task.:

    Output:

    Explanation: This command will schedule the 'echo hello' command to run one minute from now.

  • Canceling a scheduled 'at' command task.:

    Explanation: This command will remove the 'at' job with the id 7.

Tips

  • Remember to use Ctrl-D to signify the end of input when typing the command directly into the terminal.

  • The 'atq' command can be used to view the current 'at' job queue.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Advanced Use Cases of at Command in Linux

  • Scheduling a command to run on a specific date and time.:

    Output:

    Explanation: This command will schedule the 'echo hello' command to run at 08:00 on December 31.

  • Scheduling a script to run at a relative time in the future.:

    Output:

    Explanation: This command will schedule the 'script.sh' to run one week from now.

  • Using the '-l' option to list all the jobs in the queue with their identifiers.:

    Output:

    Explanation: This command will list all 'at' jobs, showing their job ids and the times they are scheduled to run.

Conclusion

  • The 'at' command in Linux is a versatile tool for scheduling tasks to be performed at a later time.

  • The basic syntax includes the command, a time (either specific or relative), and the task to be performed.

  • There are numerous options that can be used to modify the behavior of the 'at' command, including specifying a queue, reading the job from a file, and displaying the version number.

  • The 'atq' command can be used to view current 'at' jobs, and the 'atrm' command can be used to cancel scheduled jobs.