Tag: Tutorials

Linux File & Directory Operations: ls, cd, cp, mv, rm, find

Working reference for the Linux file and directory commands you type thousands of times a year. ls with -l/-la/-lh/-ltr/-ld variations, the cd - bounce trick, mkdir -p for idempotent path creation, cp -a for archive-style copies (with the trailing-slash gotcha), mv for both rename and move, rm -rf danger and the safer find -print -> find -delete pattern, find by name/size/mtime/owner with -exec and -delete, locate vs find (locate is fast but stale), symbolic links with ln -s, the 10 commands that cover 95 percent of daily use, and the common pitfalls (rm -rf with unset variable, trailing-slash confusion, unquoted spaces in filenames).