Handy Linux Commands· 1 minute read
I use most of these commands every day to simplify my terminal interactions with an Ubuntu development box. This is more of a personal reference but thought I would share incase you find it useful.
Get all users on the system
for user in `getent passwd | cut -d: -f1`; do id $user; done
Delete all .svn or any file name by replacing .svn in the command with your filename
find ./ -name ".svn" | xargs rm -Rf
Look for enabled modules or particular environment settings in PHP
php -r 'phpinfo();' | grep 'searchkeyword'
php -r 'phpinfo();' | grep 'json' to find out if JSON is installed and what version of the module is available
Push a line of text into a file
to reset file content to ‘text to push’ –
echo 'text to push' > /etc/file
to append to file content ‘text to push’ –
echo 'text to push' >> /etc/file
Create an empty file
Watch a file on the command line. Useful for viewing logs whilst debugging.
tail -f /var/log/filename.ext use
control + c to break
Break the current command
Use the keyboard combination
control + c
Access to MySQL