> For the complete documentation index, see [llms.txt](https://wiki.ravi.ws/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.ravi.ws/linux/linux-commands.md).

# Linux Commands

## Get familiar with the environment

Listing some useful ones:

• id: know yourself&#x20;

• w: who is logged in (-f to find where they are logging in from)&#x20;

• lsblk: list block storage devices • lscpu: display info about the CPUs&#x20;

• lstopo: display hardware topology (need hwloc, hwloc-gui packages)&#x20;

• free: free and used memory (try free -g)&#x20;

## Command Navigation

• lsb\_release: distribution info (try -a)

Be nice and fly under the radar, eg.: nice -n 19 tar cvzf archive.tgz large\_dir

![](/files/-M7eUqondUUIl7Dj2b4v)

![](/files/-M7eV458E4HpHMYi_tGV)

## Saving some time and hair follicles

!! repeats the last command

• !$ change command keep last argument:\
• cat states.txt # file too long to fit screen • less !$ #reopen it with less

• !\* change command keep all arguments:\
• head states.txt | grep '^Al' #should be tail\
• tail !\* #no need to type the rest of the command

## Find Command

![Find Command Structure](/files/-M7eofYPipQ075X-FBqq)

![Examples](/files/-M7eopIKeXs00CGIvs1w)

## Scheduling Tasks

![Anatomy of crontab entry](/files/-M7epcuHpUsT7w8a7wpF)

Source: [Linux Productivity Tools (2019) \[pdf\]](https://www.usenix.org/sites/default/files/conference/protected-files/lisa19_maheshwari.pdf)
