Linux find process by name

You can find a process by its name in Linux using the ps and grep commands. Here’s an example of how to find a process by its name: ps -ef | grep process-name The ps -ef command lists all running processes on the system, and the grep command filters the output to show only the … Read more

Linux append text to end of file

You can append text to the end of a file in Linux using the echo command and the >> operator. The echo command outputs the specified text, and the >> operator appends the output to the end of the specified file. Here’s an example of how to append text to the end of a file … Read more

How to copy a single file to multiple directories in Linux or Unix

In Linux or Unix, you can copy a single file to multiple directories using a loop in a shell script. Here’s an example script that uses the cp command to copy the file file.txt to multiple directories dir1, dir2, and dir3: #!/bin/bash directories=(dir1 dir2 dir3) file=file.txt for dir in “${directories[@]}”; do cp “$file” “$dir” done … Read more

Linux/Unix: Force ssh client to use only password auth authentication when pubkey auth configured

You can force an ssh client to use only password authentication when public key authentication is also configured by using the -o PreferredAuthentications=password option when connecting to the server. For example: ssh -o PreferredAuthentications=password user@server This option tells ssh to only use password authentication and ignore any public key authentication that may be configured. The … Read more