Handy commands in Mac/Linux systems

Here’s a list of common commands I use in Linux. I will continue to update this list with more stuff.

  1. Checking fireball logs:
  2. [code lang=”bash” gutter=”false”]
    cat /var/log/appfirewall.log

    # You will see stuff like
    Jun 21 10:37:51 prakhars-MacBook-Pro Firewall[90]: postgres is listening from 0.0.0.0:5432 proto=6
    Jun 21 10:38:11 prakhars-MacBook-Pro Firewall[90]: mysqld is listening from ::ffff:0.0.0.0:3306 proto=6
    Jun 21 10:40:21 prakhars-MacBook-Pro Firewall[90]: Dropbox is listening from 0.0.0.0:17500 proto=6
    Jun 21 10:40:21 prakhars-MacBook-Pro Firewall[90]: java is listening from ::ffff:0.0.0.0:0 proto=6
    Jun 21 10:44:38 prakhars-MacBook-Pro Firewall[90]: GoogleTalkPlugin is listening from 127.0.0.1:49198 proto=6
    Jun 21 10:45:35 prakhars-MacBook-Pro Firewall[90]: python is listening from 127.0.0.1:8000 proto=6
    [/code]

  3. screen command: Use it to create parallel sessions in terminal. Useful for running long processes on remote servers even after signing out of server.Usage:
    [code lang=”bash”]
    screen
    # This creates a separate screen.

    screen -ls
    #lists all attached/detached screens IDs

    screen -x 13152
    # Enter (Attach) screen ID 13152 (just an example, can be any ID number)

    echo $STY
    # Displays current screen ID you are working in.
    [/code]
    Ctrl-a d Detach from current screen.

  4. dpkg --get-selections List all installed packages. (Only on debian systems like Ubuntu which support apt-get)
    Smartly grep to find package you are looking for eg- dpkg --get-selections | grep mysql

Leave a Reply

Your email address will not be published.