Useful Linux Commands-2
Files
| Command | Description |
| ls -la | Lists files l: Use a long listing format a: List all entries including those starting with a dot |
| pwd | Displays working directory |
| rm | is used to delete files. When used recursively, it may be used to delete directories. |
| rm -r | Removes directories and their contents recursively. |
| rm -f | Ignores nonexistent files, and never prompt before removing. |
| rm -rf | forces the directory to delete |
| cp | is makes copies of files and directories. |
| cp -r | Copıes directories recursively. |
| mv | moves, or renames, files and directories on your filesystem. |
| ln -s | Creates a symbolic link |
| touch | is also an easy way to create empty files. |
| cat | reads data from files, and outputs their contents. |
| more | is a filter for paging through text one screen at a time. |
| head | Displays first 10 lines of the file content |
| tail | Displays the last 10 lines of the contents of the file |
| tail -f | Displays the last 10 lines of the contents of the file in real time |
Processes
| Command | Description |
| ps | Reports a snapshot of the status of currently running processes. |
| ps aux | gives output with all options implemented |
| pmap -x PID | Gives the memory map of the process |
| top | The top commands provide a dynamic real-time view of a running system. It can display system summary information, as well as a list of processes or threads currently being managed by the kernel. |
| kill | Kills a process |
| killall | kills all processes |
| pkill -f telnet | finishes the process |
| bg | is a job control command that resumes suspended jobs while keeping them running in the background. |
| fg | resume the most recently suspended or backgrounded job. |
Permissions
| Command | Description |
| chattr +i | files cannot be deleted but untouchable |
| chattr -i | removes untouchable |
| chattr +a | Preserves existing rows, allowing rows to be added to the bottom. |
| lsattr | Checks if the chattr command is valid |
| chmod 777 | everything can be read, written and executed. |
| chmod 644 | read-only |
| chmod 755 | only the owner reads, writes and executable. |
| chown owner-user | changes the owner of the file |
| chown owner-user:owner-group | changes the owner and group of the file |
| chown -R | gives the user access with its directories |
