The crontab -l command displays the contents of a crontab
file much the same way that the cat command
displays the contents of other types of files. You do not have to change the directory
to /var/spool/cron/crontabs
directory (where crontab files are located) to use this command.
By default, the crontab -l command displays your own crontab
file. To display crontab
files that belong
to other users, you must be superuser.
How to Display a crontab File
Become superuser or assume an equivalent role to display a crontab
file that belongs to root
or another user. Roles contain
authorizations and privileged commands. For more information about roles, see
Configuring RBAC (Task Map) in System Administration Guide: Security Services
.
You do not need to become superuser or assume an equivalent role to display
your own crontab
file.
Display the crontab
file.
$crontab -l
[username
]
where username
specifies the name of the user's account
for which you want to display a crontab
file. Displaying another
user's crontab
file requires superuser privileges.
If you accidentally type the crontab command with
no option, press the interrupt character for your editor. This character allows you
to quit without saving changes. If you instead saved changes and exited the file,
the existing crontab
file would be overwritten with an empty
file.
Example 15.2. Displaying a crontab
File
This example shows how to use the crontab -l command
to display the contents of the user's default crontab
file.
$ crontab -l
13 13 * * * chmod g+w /home1/documents/*.book > /dev/null 2>&1
Example 15.3. Displaying the Default root
crontab
file.
This example shows how to display the default root
crontab
file.
$su
Password: Sun Microsystems Inc. SunOS 5.10 s10_51 May 2004 #crontab -l
#ident "@(#)root 1.19 98/07/06 SMI" /* SVr4.0 1.1.3.1 */ # # The root crontab should be used to perform accounting data collection. # # 10 3 * * * /usr/sbin/logadm 15 3 * * 0 /usr/lib/fs/nfs/nfsfind 30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean #10 3 * * * /usr/lib/krb5/kprop_script ___slave_kdcs___