Where to start First steps track · 15 stages
Linux Labs

Basic file commands

cheat sheet · Linux · bash https://lab.dimsanych.ru/en/wiki/files-basics/

Cheat sheet

  • ls -lah detailed directory listing
  • cd dir go into a directory
  • pwd where am I now
  • cp -a src dst copy, preserving permissions/time
  • mv a b move/rename
  • rm -i f remove with confirmation
  • mkdir -p a/b create with intermediate directories
  • touch f create an empty file / update its time
  • ln -s tgt link a symbolic link
  • tail -f log follow a log in real time
  • less file page through a file (q to quit)
  • head -n20 f the first 20 lines
  • cmd1 | cmd2 pipe the first command's output into the second
  • cmd > out 2>&1 stdout and stderr into a file
  • Ctrl+R (history) · Ctrl+L (clear) · !! (repeat)

Options

Below are the main flags of ls, cp, mv, rm, mkdir; each command has its own detailed article (see "See also") — this is the minimum for basic work.

Loading…