Jul 31, 2024
ls
Commandls
: Lists directory contents.-l
: Long listing format.
-a
: Shows hidden files (those starting with .
).-t
: Sorts by modification time, newest first.-h
: Human-readable file sizes.ls -lath
for all combined.cd
Commandcd
: Change directory.cd -
: Returns to the previous directory.cd ..
: Moves up one directory level.cd
: Returns to home directory.pwd
: Print working directory.touch
: Creates empty files (e.g. touch file1 file2).mkdir
: Makes directories (e.g. mkdir dir1).mkdir -p
: Creates nested directories.mkdir -m 777 dir
sets full permissions.cp
: Copy files (e.g. cp file1 file2).cp -r
: Copy directories recursively.rm
: Remove files (e.g. rm file1).rm -r
: Remove directories recursively.rm -rf
: Force remove files/directories (use with caution).mv
: Move or rename files (e.g. mv file1 newlocation).du
: Disk usage of files and directories.-h
: Human-readable format.-s
: Summary of total usage.chmod
: Change permissions (e.g. chmod g+rw file).u
(user), g
(group), o
(others), a
(all).chmod 777 file
gives full permissions.chown
: Change file ownership (e.g. chown user:group file).cat
Commandcat
: Concatenate and display file contents.cat file1 >> file2
appends file1 to file2.tail
Commandtail
: Displays last part of a file.-n
: Number of lines to display.-f
: Follow file updates (real-time).head
Commandhead
: Displays first part of a file.-n
: Number of lines to display.less
and more
less
: View file contents page by page (better than more
).more
: Similar to less
but with fewer features.vi
and nano
vi
: Powerful, complex text editor.nano
: User-friendly, easy-to-use text editor.ps
: Display current processes.ps aux
: Detailed process listing.grep
: Filter processes (e.g. ps aux | grep processname).top
Commandtop
: Real-time process monitoring.htop
: Enhanced version of top
.kill
: Terminate process by ID (e.g. kill 1234).kill -9
: Force kill (use with caution).command &
to run in background.jobs
: List background jobs.fg
: Bring background job to foreground.ifconfig
: Network interface configuration (deprecated).ip
: Newer command replacing ifconfig
(e.g. ip addr
).ip route
: Show routing table.ssh
: Securely connect to remote machines.scp
: Securely copy files between machines.netstat
: Network statistics (deprecated).ss
: Newer command showing socket statistics.find
Commandfind
: Search for files (e.g. find /home -name '*.txt').grep
: Search text within files.tar
and gzip
tar
: Archive files into a tarball (e.g. tar -czf archive.tar.gz dir).gzip
: Compress files (e.g. gzip file).gunzip
for .gz
files, tar -xzf
for tarballs.useradd
: Add a new user (e.g. useradd username).userdel
: Delete a user (e.g. userdel username).groupadd
: Add a new group (e.g. groupadd groupname).groupdel
: Delete a group (e.g. groupdel groupname).