Linux Commands

  • apt-get install x-window-system-core xserver-xorg gnome-desktop-environment – install necessities for the gnome gui
  • sudo passwd root – I installed Ubuntu Server 8.10 and it didn’t set the root password upon installation so I was forced to set it later in order to be able to gain root access
  • export EDITOR=usr/bin/vim – The default editor for ‘visudo’ was set to usr/bin/nano, and I wanted to use the vim editor, so executing this command changed that. Initially I tried someone’s example of export EDITOR=vim and that didn’t work, you have to declare the full path for the editor
  • nano /etc/ssh/sshd_config – Open the ssh configuration file using nano
  • /etc/init.d/ssh reload – Reload the ssh service
  • nano ~/.bashrc – Edit the file that Bash runs commands from – Handy for setting up Aliases (shortcuts to run long commands) – Example (alias l2r=”sudo /etc/init.d/lighttpd restart”)
  • source ~/.bashrc – Reload the bashrc file so Bash can take advantage of whatever you just put in it
  • sudo locale-gen en_GB.UTF-8 – Declare a locale, in this case English, so it downloads English manuals when you do system updates
  • sudo aptitude safe-upgrade – “It is sometimes necessary to remove or install one package in order to upgrade another; this command is not able to upgrade packages in such situations. Use full-upgrade instead”
  • ls -altr – list all files in long format based on reverese timestamp (most recent last)
  • wc -l – Counts the number of lines in the output or file
  • grep -r – recursive grep search
  • basename/dirname – Variables for shell scripts that return the filename (basename) or the directory name
  • %s/search_string/replacement_string/g