Skip to content

Latest commit

 

History

History
57 lines (52 loc) · 2.86 KB

Command Line Tips.md

File metadata and controls

57 lines (52 loc) · 2.86 KB

Command-line Tips

  1. ls: list the contents of a directory
  2. cd $dir: change to directory $dir
  3. cd ..: go one directory up
  4. cd -: go to previous directory, basically a "back button"
  5. pwd: "print working directory" (show which directory you're in)
  6. mkdir $name: create directory $name
  7. mv $dir $location: move $dir to $location
  8. cd ~ go home.
  9. cd without a directory, go home.
  10. vi, nano text editors. :q quits vim.
  11. man the manual.
  12. sudo do as super-user. USE AT OWN RISK.
  13. ssh secure shell. Use to connect to servers.
  14. rm remove a file.
  15. mkdir make a directory.
  16. cp copy a file or directory
  17. mv move a file or directory
  18. git use Git commands.
  19. less read a file in the command line.
  20. !! replaced by previously run command. !1, !2,... go further back.
  21. cat output a file to the command line.
  22. echo print a message.
  23. cmd1 | cmd2 take the output of cmd1 and put it in cmd2. Called piping.
  24. cmd > file take the output of cmd and put it in a file. This replaces everything in the file. cmd >> file appends instead of overwriting.
  25. cmd1 && cmd2 and cmd1 || cmd2 Logical operations. Do cmd1 and cmd2, or cmd1 or cmd2.
  26. chown take ownership of a file. Useful if you download something as root.
  27. chmod make a file executable, among other uses.
  28. touch create a file. More precisely, update the modification time of a file, or create it if it doesn't exist.
  29. ssh-keygen generate a new ssh key for passwordless login on remote servers.
  30. wget download a file from the interwebz.
  31. top, htop, ps -eax display process information.
  32. which gives the path to a command.

And now for something a little different.

  1. lolcat pipe a command into lolcat to make the output colorful. Some commands are broken for this.
  2. cowsay similar to lolcat, make a cow say the output.
  3. toilet make the output in big ASCII letters. Try mixing these three together to get some interesting results.
  4. sl make a train. A punishment to teach ls.
  5. ddate get the day in a fictional calendar.
  6. fortune get a random quote.
  7. neofetch display system information with a cool logo. Looks nicer than cat /proc/cpuinfo.
  8. cmatrix make it rain digital rain.

Get linux commands on windows

WSL. Windows Subsystem for Linux (WSL) lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications - directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup. This will give us access to more modern commandline interfaces on windows machines.

https://docs.microsoft.com/en-us/windows/wsl/install

For BASH users.

If the anaconda install overwrites your bash profile, add a source command to end of ~/.bashrc

if [ -f ~/.profile ]; then
		source ~/.profile
fi