Knowledgebase

Articles

 Archiving

Create a compressed archive (tape archive): tar zcvf archive.tar.gz dirtar jcvf archive.tar.bz2...

 Commands for Handling files and directories

Create a directory:  mkdir dir Create nested directories: mkdir -p dir1/dir2Changing...

 Commands for changing file access rights

Add write permissions to the current user:chmod u+w fileAdd read permissions to users in the file...

 Compressing

Compress a file:gzip file (.gz format)bzip2 file (.bz2 format, better)lzma file (.lzma format,...

 Displaying file contents

Concatenate and display file contents:cat file1 file2Display the contents of several files...

 File and partition sizes

Show the total size on disk of files or directories (disk usage): du -sh dir1 dir2 file1...

 File name pattern matching

Concatenate all “regular” files: cat *Concatenate all “hidden” files: cat .*Concatenate all files...

 Handling file contents

Show only the lines in a file containing a given substring: grep substring fileCase insensitive...

 Job control

Show all running processes: ps -efLive hit-parade of processes (press P, M, T: sort by Processor,...

 Linux File Hierarchy Structure

The Linux File Hierarchy Structure or the Filesystem Hierarchy Standard (FHS) defines the...

 Listing files

List all “regular” files (not starting with .) in the current directory:lsDisplay a long...

 Looking for files

Find all files in the current (.) directory and its subdirectories with log in their name:  find...

 Redirecting command output

Redirect command output to a file:ls *.png > image_filesAppend command output to an existing...

 commands for comparing files and directories

Comparing 2 files: diff file1 file2Comparing 2 files (graphical):gvimdiff file1 file2tkdiff file1...