Vi / Vim Quit Without Saving Command

To quit the Vim editor without saving changes, you can use the following command while in normal mode: :q! The “!” forces the quit without saving any changes. If you have made changes to a file in Vim and you want to exit without saving those changes, simply type the above command and press “Enter”. … Read more

Linux / Unix: pwdx Command Examples

The “pwdx” command in Linux/Unix is used to display the current working directory of a process. Here are some examples of using the “pwdx” command: Display the current working directory of a specific process: pwdx process-id Replace “process-id” with the actual process ID that you want to check. Display the current working directories of multiple … Read more

Ubuntu / Debian: Restart Named Service Command

To restart a named service on Ubuntu or Debian, you can use the following command: sudo systemctl restart service-name.service Replace “service-name” with the actual name of the service you want to restart. For example, to restart the Apache web server, you would run: sudo systemctl restart apache2.service You need to have root privileges (using “sudo”) … Read more

Linux / Unix: users Command Examples

The “users” command in Linux/Unix is used to list the names of the users who are currently logged into the system. Here are some examples of using the “users” command: List all logged in users: users Display names of users in a specific format: users | tr ‘ ‘ ‘\n’ This will display each username … Read more

Linux / Unix: w Command Examples

The “w” command in Linux/Unix displays information about the users who are currently logged into the system, and what they are doing. Here are some examples of using the “w” command: Display information about all users: w Display information about a specific user: w username Display information in a specific format: w -h The -h … Read more

Linux / Unix last Command Examples

The “last” command in Linux/Unix is used to display a list of recent login sessions on the system. Here are some examples of using the last command: Display a list of all login sessions: $ last Display a list of only the latest login session for each user: $ last -f /var/log/wtmp -1 Display a … Read more