Site Tools


linux:scripts:basics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
linux:scripts:basics [2014/10/01 13:21] lunetikklinux:scripts:basics [2018/12/20 17:44] – Discussion status changed lunetikk
Line 1: Line 1:
- 
-===== Linux Commands ===== 
- 
-^  Command  ^  Function  ^ 
-|  cd /blabla/  |  cd (change directory), changes the current directory to blabla  |\\ 
-|  pwd  |  shows current directory  |\\ 
-|  ls  |  shows all files and folders in the current directory in one line -> confusing)  |\\ 
-|  ll  |  = ls –al ->  shows all files and folders + owner + size, 1 item each line  |\\ 
-|  alias  |  shows alias like „..“ for „cd ..“  |\\ 
-|  cat [textfile]  |  displays the full file  |\\ 
-|  tail [-f -n 20]  |  displays the last 20 lines of the file – extension „–f“ refreshes the file, extension „–n 20“ displays the last 20 lines  |\\ 
-|  head  |  same a tail but it displays the first lines  |\\ 
-|  touch [file]  |  create a file / refresh the timestamp  |\\ 
-|  chmod 777 [file]  |  change rights of a file  |\\ 
-|  chown user:group [directory] –R  |  change owner and group, -R changes the complete directory including files and subdirectorys  |\\ 
-|  useradd –m  |  add a user  |\\ 
-|  groupadd  |  add a group  |\\ 
-|  cp source target [-r -a]  | copy data, -r copy directory, -a keep the rights  |\\ 
-|  mv source target  |  move file or directory  |\\ 
-|  rm –r  |  removes a directory with all data in it / rmdir only removes empty directorys  |\\ 
-|  cut –d : -f 1,3  |  : is the delimiter and 1 and 3 are the columns  |\\ 
-|  echo " " > test.sh  |  deletes the entries of a textfile  |\\ 
-|  which sutp  |  shows path of sutp  |\\ 
-|  echo $?  |  0 = success of the last command  |\\ 
-|  env  |  run a program in a modified environment    |\\ 
-|  uptime  |  shows how long your machine is running  |\\ 
-|  mkdir –p /abc/abc  |  create a directory including a subdirectory  |\\ 
-|  rpm –ivh  |  install a rpm file (install verbose hash)  |\\ 
-|  mount /dev/[cdrom, sr, hdc or tabtab]  |  mount VMWaretools  |\\ 
- 
- 
-===== Debian Commands ===== 
- 
-^  Command  ^  Function  
-|  apt-cache search [Package]  |  search for [Package] (example nano)  |\\ 
-|  apt-get install [Package]  |  installs [Package]  |\\ 
-|  apt-get update  |  update sources.list  |\\ 
-|  apt-get upgrade  |  update all installed packages  |\\ 
-|  apt-get remove [Package]  |  remove [Package]  |\\ 
-|  apt-get purge [Package]  |  remove [Package] and its configs  |\\ 
-|  dkpg --install [Package.deb]  |  installs offline packages  |\\ 
-|  aptitude install [Package]  |  installs [Package] alt. apt-get  |\\ 
-|  service [Service] start/stop  |  start/stop a service (rc for Suse)  |\\ 
- 
- 
-\\ 
-== EasterEggs == 
- 
-^  Command  ^  Function  
-|  apt-get moo  |  Try it out ;)  |\\ 
-|  aptitude moo  |  Try it out and add aptitude -v[vvvvv] moo ;)  |\\ 
- 
- 
- 
 ====== Script ====== ====== Script ======
  
Line 62: Line 8:
 |  $VAR  |  inserts var whereever $VAR is placed  | |  $VAR  |  inserts var whereever $VAR is placed  |
 |  case - esac  |  inserts case  | |  case - esac  |  inserts case  |
-|  if fi  |  inserts if  |+|  if [ "var" == "var" ]; then fi  |  inserts if  |
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
Line 68: Line 14:
 ==== Interpreter error ==== ==== Interpreter error ====
  
-Problem: \\+=== Problem: ===
 Running your script prompts interpreter error\\ Running your script prompts interpreter error\\
  
-Fix: \\+=== Fix: ===
 Open your script with vi and execute the following Open your script with vi and execute the following
 <code> :set fileformat=unix </code> <code> :set fileformat=unix </code>
Line 77: Line 23:
 ==== Not enough rights ==== ==== Not enough rights ====
  
-Problem: \\+=== Problem: ===
 Running your script requires more rights Running your script requires more rights
  
-Fix:\\ +=== Fix: === 
-Make your script runable by executing the following code+Make your script executable with the following command
 <code>chmod +x [scriptname].sh</code> <code>chmod +x [scriptname].sh</code>
 +\\ 
 +\\ 
 +~~DISCUSSION:closed~~
  
linux/scripts/basics.txt · Last modified: 2021/01/07 14:55 by lunetikk