System and processes

This topic gathers the commands that deal with the running system rather than with files: reading the time, asking what hardware and system you are on, launching another command under some constraint, signalling a process, working with the terminal.

The commands #

Time

CommandPurpose
datePrint — or set — the system date and time.
sleepPause for a given length of time.
uptimeShow how long the system has been running.

Running a command under a constraint

CommandPurpose
timeoutRun a command, and kill it if it runs too long.
nohupRun a command so it survives the terminal closing.
niceRun a command at an adjusted scheduling priority.
stdbufRun a command with altered stream buffering.
chrootRun a command with a different directory as its root.

Signalling processes

CommandPurpose
killSend a signal to a process.

System identity and capacity

CommandPurpose
unamePrint system information — the OS, the kernel, the machine.
archPrint the machine's hardware architecture.
hostnameDisplay — or set — the system's host name.
hostidPrint the host's numeric identifier.
nprocPrint how many processor cores are available.

Who you are

CommandPurpose
whoamiPrint the name of the user a process is running as.
idPrint the user and group identity of a process, or of a named user.
groupsPrint the groups a user belongs to.
lognamePrint the login name of the user a process is running as.

These report the projection of a token onto POSIX user and group numbers, which is what Linux programs see. The numbers grant nothing on their own — id explains what they can and cannot say, and token shows the identity underneath them.

Storage and terminal

CommandPurpose
syncFlush cached writes out to persistent storage.
ttyPrint the name of the terminal on standard input.
sttyDisplay or change terminal settings.

A note on changing the system #

Most commands here only report. A few can change the running system — date can set the clock, hostname can set the host name. Changing system-wide state is a privileged operation: it succeeds only for a caller whose token holds the right to do it, and is refused otherwise. The pages for those commands say so where it applies, and Privileges is the full picture.

Where to start #

uname answers "what am I running on?". kill is the one to read carefully — sending the wrong signal to the wrong process is a quick way to lose work.

Edit this page