Linux Command Essentials

Survival guide for the command line.

pwd                     # current directory
ls -la                  # list with details + hidden files
cd /path/to/dir
cd ~                    # home
cd -                    # previous directory

File operations

cp file1 file2          # copy
cp -r dir1 dir2         # copy directory
mv file1 file2          # move / rename
rm file                 # delete file
rm -rf dir              # delete directory (careful!)
mkdir -p a/b/c          # create nested directories
cat file.txt            # print file
less file.txt           # paged view
grep "pattern" file     # search in file
grep -r "pattern" .     # recursive search
find . -name "*.py"     # find files by name

Process management

ps aux                  # list processes
top / htop              # interactive monitor
kill <pid>              # terminate process
kill -9 <pid>           # force kill

Permissions

chmod 755 file          # rwxr-xr-x
chmod +x script.sh      # make executable
chown user:group file   # change owner

Networking

curl https://url        # HTTP request
wget https://url        # download file
ss -tlnp                # open ports