Getting the last match in a file using grep
You could try grep pattern file | tail -1 or tac file | grep pattern | head -1 or tac file | grep -m1 pattern
You could try grep pattern file | tail -1 or tac file | grep pattern | head -1 or tac file | grep -m1 pattern
I did mysql> SHOW GLOBAL VARIABLES LIKE ‘PORT’; And that indicated that I was using port 3306 and that my search for the error continues.
This should work on Linux and SysV5 ps -ef –sort=start_time
crontab -e then comment out each line you don’t want to run with #.
The ~/.ssh/config file don’t have a directive for including other files, possibly related to SSH’s check for file permissions. Suggestions around this can include a script to cat several changes together either on the system or via checkin hooks on a repository. One might also look into tools such as Puppet or Augeas. However you … Read more
What can be simpler than echo $!? As one line: myCommand & echo $!
Under Linux, the usermod command changes user names. It modifies the system account files to reflect the changes that are specified on the command line. To change just the username: usermod –login new_username old_username To change the username and home directory name: usermod –login new_username –move-home –home path_to_the_new_home_dir old_username You may also want to change … Read more
Actually there is a way to kill a connection – killcx. They claim it works in any state of the connection (which I have not verified). You need to know the interface where communication happens though, it seems to assume eth0 by default. UPDATE: another solution is cutter which comes in some linux distros’ repositories.
This sed line should do the trick: sed -i ‘/^$/d’ file.txt The -i means it will edit the file in-place.
For more data on the layout of Linux file-systems, look at the Filesystem Hierarchy Standard (now at version 2.3, with the beta 3.0 version deployed on most recent distros). It does explain some of where the names came from: /bin – Binaries. /boot – Files required for booting. /dev – Device files. /etc – Et … Read more