|   |  | 
| (32 intermediate revisions by the same user not shown) | 
| Line 1: | Line 1: | 
|  | = Links touseful Linuxthings =
 |  | A place to get started to understand Linux commands and tools | 
|  | 
 |  | 
 | 
|  | - [https://matomo.mintarc.com/mediawiki/index.php?title=Common_Commands_with_examples Common Commands ]
 |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Common_Commands_with_examples Common Commands ] | 
|  | - https://matomo.mintarc.com/mediawiki/index.php?title=SSH_Stuff
 |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=SSH_Stuff SSH Stuff] | 
|  |   |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Create_monitor_and_terminate_process Create, monitor and terminate process]  | 
|  | = SSH Stuff=
 |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=SystemD_Stuff SystemD Stuff] | 
|  |   |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Desktop_environment Desktop Environment] | 
|  | = systemd =
 |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Directory_Manipulation_and_Management Directory Manipulation and Management] | 
|  | = Create, monitor and terminate process = |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Perform_basic_file_management Perform basic file management] | 
|  | == & - Run a command in the background ==
 |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Hard_and_symbolic_links_Weight Hard and symbolic links Weight] | 
|  | The & symbol is used to run a command or script in the background, allowing you to continue using the terminal.
 |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=File_placement_and_search File placement and search] | 
|  |   |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Process_text_stream_with_filters Process text stream with filters] | 
|  | Examples:
 |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Use_streams,_pipes_and_redirects Use streams, pipes and redirects] | 
|  | *long_running_script.sh &: Run the script in the background
 |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Search_text_files_using_regular_expressions Search text files using regular expressions] | 
|  | *sleep 60 &:Run the sleep command for 60 seconds in the background |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Perform_basic_file_edits_using_an_editor Perform basic file edits using an editor] | 
|  | *nohup command &: Run a command in the background, immune to hangups
 |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Repository_and_Package_Management Repository and Package Management] | 
|  |   |  | * [https://matomo.mintarc.com/mediawiki/index.php?title=Debian_package_management Debian package management] | 
|  | == bg - Resume suspended jobs in the background ==
 |  | * [[Linux_Kernel|The Linux Kernel]] | 
|  | bg resumes execution of a suspended job in the background.
 |  | * [[Init_Systems|Explaining Init Systems]] | 
|  |   |  | * [[Linux_Virtual_Machines|Linux Virtual Machines]] | 
|  | Examples:
 |  | * [[Mmdebstrap|mmdebstrap]] | 
|  | *bg %1: Resume the first suspended job in the background
 |  | 
|  | *bg %vim: Resume the suspended vim job in the background
 |  | 
|  | *bg: Resume the most recently suspended job in the background
 |  | 
|  |   |  | 
|  | == fg - Bring background jobs to the foreground ==
 |  | 
|  | fg brings a background job into the foreground, allowing direct interaction.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *fg %2: Bring the second background job to the foreground
 |  | 
|  | *fg %emacs: Bring the background emacs job to the foreground
 |  | 
|  | *fg: Bring the most recent background job to the foreground
 |  | 
|  |   |  | 
|  | == jobs - Display status of jobs in the current session == |  | 
|  | jobs lists the active jobs in the current shell session.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *jobs:List all jobs |  | 
|  | *jobs -l: List jobs with process IDs
 |  | 
|  | *jobs -p: List only process IDs of the active jobs
 |  | 
|  |   |  | 
|  | == nohup - Run a command immune to hangups ==
 |  | 
|  | nohup allows a command to continue running after the user logs out.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *nohup long_running_script.sh &: Run a script that continues after logout
 |  | 
|  | *nohup command > output.log 2>&1 &: Run a command, redirecting output anderrors
 |  | 
|  | *nohup python script.py &: Run a Python script that persists after terminal closure |  | 
|  |   |  | 
|  | == screen - Terminal multiplexer ==
 |  | 
|  | screen creates a virtual terminal that can be detached and reattached, allowing sessions to persist.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *screen: Start a new screen session
 |  | 
|  | *screen -S session_name: Start a named screen session
 |  | 
|  | *screen -r: Reattach to a detached screen session
 |  | 
|  | *screen -list: List available screen sessions
 |  | 
|  |   |  | 
|  | == tmux - Terminal multiplexer == |  | 
|  | tmux, like screen, allows for persistent terminal sessions and window management.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *tmux:Start a new tmux session |  | 
|  | *tmux new -s session_name: Create a named tmux session
 |  | 
|  | *tmux attach -t session_name: Attach to an existing session
 |  | 
|  | *tmux ls: List active tmux sessions
 |  | 
|  |   |  | 
|  | == top - Display and update sorted information about processes ==
 |  | 
|  | top provides a dynamic real-time view of running system processes.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *top: Display system processes, updating every 3 seconds
 |  | 
|  | *top -u username: Show processes for a specific user
 |  | 
|  | *top -p 1234,5678: Monitor specific processes by PID
 |  | 
|  |   |  | 
|  | == ps - Report a snapshot of current processes ==
 |  | 
|  | ps displays information about a selection of the active processes.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *ps aux: Display detailed information about all processes
 |  | 
|  | *ps -ef: Show all processes in full format
 |  | 
|  | *ps --sort=-%cpu: List processes sorted by CPU usage (descending)
 |  | 
|  |   |  | 
|  | == pstree - Display a tree of processes ==
 |  | 
|  |   |  | 
|  | pstree shows the running processes as a tree, which is helpful for understanding process relationships.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *pstree: Display process tree
 |  | 
|  | *pstree -p: Show process IDs along with the tree
 |  | 
|  | *pstree -u: Show user names for each process
 |  | 
|  |   |  | 
|  | == uptime - Show how long the system has been running ==
 |  | 
|  | uptime displays the current time, system uptime, number of users, andload average.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *uptime:Display system uptime and load |  | 
|  | *uptime -p: Show uptime in a pretty format
 |  | 
|  | *uptime -s: Display the system up since time
 |  | 
|  |   |  | 
|  | == pgrep - Look up or signal processes based on name and other attributes ==
 |  | 
|  | pgrep looks through the currently running processes and lists the process IDs which match the selection criteria.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *pgrep firefox: List PIDs of firefox processes
 |  | 
|  | *pgrep -u root: List PIDs of processes owned by root
 |  | 
|  | *pgrep -l sshd: List PIDs and names of sshd processes
 |  | 
|  |   |  | 
|  | == kill - Send a signal to a process ==
 |  | 
|  | kill sends a signal to a process, by default the TERM signal to request termination.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *kill 1234: Send SIGTERM to process with PID 1234
 |  | 
|  | *kill -9 5678: Send SIGKILL to forcefully terminate process 5678
 |  | 
|  | *kill -l: List available signals
 |  | 
|  |   |  | 
|  | == pkill - Signal processes based on name andother attributes == |  | 
|  | pkill looks up processes based on name and other attributes and sends them a signal.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *pkill firefox:Send SIGTERM to all firefox processes |  | 
|  | *pkill -9 httpd: Send SIGKILL to all httpd processes
 |  | 
|  | *pkill -u username: Terminate all processes owned by username
 |  | 
|  |   |  | 
|  | == killall - Kill processes by name ==
 |  | 
|  | killall sends a signal to all processes running any of the specified commands.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *killall nginx: Terminate all processes named nginx
 |  | 
|  | *killall -9 apache2: Forcefully kill all apache2 processes
 |  | 
|  | *killall -u username bash: Kill all bash processes for a specific user
 |  | 
|  |   |  | 
|  | = Desktop environment =
 |  | 
|  | == startx - Start the X Window System ==
 |  | 
|  | startx is a script that initializes the X Window System session.It sets up the environment and launches the X server along with initial clients.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *startx: Start the X session withdefault settings
 |  | 
|  | *startx -- :1: Start X on display :1 |  | 
|  | *startx ~/.xinitrc: Use a custom initialization script
 |  | 
|  |   |  | 
|  | == X server - Core component of the X Window System ==
 |  | 
|  | The X server manages the display,keyboard, andmouse, handling rendering and input for client applications.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *Xorg:The most common X server implementation |  | 
|  | *Xvfb: X virtual framebuffer, a display server without a physical display
 |  | 
|  | *Xnest: Nested X server, allowing an X session within another X session
 |  | 
|  |   |  | 
|  | == X client - Application that uses the X protocol ==
 |  | 
|  | X clients are programs that use the X protocol to display their graphical user interface.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *xterm:Terminal emulator for X |  | 
|  | *xclock: Simple clock application
 |  | 
|  | *xeyes: Demo program showing eyes that follow the mouse cursor
 |  | 
|  |   |  | 
|  | == Display Manager - Graphical login manager ==
 |  | 
|  | A display manager provides a graphical login interface and starts the X session after user authentication.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *gdm: GNOME Display Manager
 |  | 
|  | *lightdm: Lightweight Display Manager
 |  | 
|  | *sddm: Simple Desktop Display Manager
 |  | 
|  |   |  | 
|  | == Window Manager - Controls window placement and appearance ==
 |  | 
|  | The window manager handles the positioning, resizing, and decorations of windows within the X environment.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *i3: Tiling window manager
 |  | 
|  | *openbox: Lightweight stacking window manager
 |  | 
|  | *awesome: Highly configurable window manager
 |  | 
|  |   |  | 
|  | == X Window System - Network-transparent windowing system ==
 |  | 
|  | The X Window System is a complete architecture for creating graphical user interfaces on Unix-like operating systems.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *X11: The current version of the X Window System protocol
 |  | 
|  | *Xlib: C library for X Window System client-side programming
 |  | 
|  | *XCB: C library for X protocol connections
 |  | 
|  |   |  | 
|  | == Integrated Desktop Environment - Complete graphical user interface == |  | 
|  | An integrated desktop environment provides a consistent user interface, including window management, filemanagement, and system settings.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *GNOME:Popular desktop environment with a focus on simplicity |  | 
|  | *KDE Plasma: Feature-rich desktop environment
 |  | 
|  | *Xfce: Lightweight desktop environment for Unix-like operating systems
 |  | 
|  |   |  | 
|  | ==xauth - X authority file utility ==
 |  | 
|  |   |  | 
|  | xauth is used to edit anddisplay the authorization information used in connecting to the X server.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *xauth list:Display the list of authority entries |  | 
|  | *xauth add :0 .$(mcookie): Add a new authority entry for display :0
 |  | 
|  | *xauth extract - $DISPLAY |ssh remote_host xauth merge -: Transfer X authority to a remote host |  | 
|  |   |  | 
|  | == DISPLAY - Environment variable for X display ==
 |  | 
|  | The DISPLAY environment variable tells X clients which display and screen to use. |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *export DISPLAY=:0: Set the display to the first local X server |  | 
|  | *echo $DISPLAY: Print the current DISPLAY value |  | 
|  | *DISPLAY=:1 xterm: Run xterm on display :1 |  | 
|  |   |  | 
|  | == Terminal program - Text-based interface for interacting with the system ==
 |  | 
|  | Terminal programs provide a command-line interface within the X environment.
 |  | 
|  |   |  | 
|  | Examples:
 |  | 
|  | *xterm: Standard terminal emulator for X
 |  | 
|  | *gnome-terminal: GNOME's terminal emulator
 |  | 
|  | *konsole: KDE's terminal emulator
 |  |