Skip to content

Instantly share code, notes, and snippets.

@stepharr
Last active May 2, 2019 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stepharr/62d2231702fadc6acb70389f65b013e1 to your computer and use it in GitHub Desktop.
Save stepharr/62d2231702fadc6acb70389f65b013e1 to your computer and use it in GitHub Desktop.
Just some simple tips to help with navigating Linux

Windows to Linux

  • Easily SSH using PUTTY by creating a shortcut passing in username and server
    • "C:\Program Files\PuTTY\putty.exe" -ssh user@<hostname>
  • Copy files from Windows to Linux and Linux to Windows
    • pscp -scp "C:\local\path\to\file" user@<hostname>:/remote/path/to/file
    • pscp -scp user@<hostname>:/remote/path/to/file "C:\local\path\to\file"

Linux Commands

  • Moving around the command line
    • Use the last argument from a previous command
      • <Esc> + .
    • Repeat the last command !!
    • Delete the last word in current command
      • <Esc> + delete/backspace
  • Finding things
    • Find a file under a specific path
      • find /path/ -type f -name 'file.ext'
    • List subdirectories of a path
      • find /path/ -type d -print
    • Find files and remove "permission denied" errors
      • find / -name <term> 2>&-
        • redirects results that errored
    • Find all of the distinct file extensions in a folder hierarchy
      • find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u
    • Find a string in files
      • grep -rnw '/path/to/files/' -e 'string_to_match'
  • Getting server info
    • Memory
      • free -m
      • top
    • Disk space
      • df -h
    • OS
      • cat /etc/os-release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment