Linux Labs: mini survival guide
Transcripción
Linux Labs: mini survival guide
Desktop Picky programming Command line From home Linux Labs: mini survival guide Enrique Soriano, Gorka Guardiola Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC 29 de septiembre de 2011 Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home (cc) 2010 Grupo de Sistemas y Comunicaciones. Some rights reserved. This work is provided under Creative Commons Attribution License - NonCommercial NoDerivs (by-nc-nd). To obtain the complete license go to http://creativecommons.org/licenses/by-sa/2.1/es. or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Linux Labs: mini survival guide Picky programming Command line From home Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Panel: application menu Applications: I Terminal: Aplicaciones → Accesorios → Terminal I Navegador: Aplicaciones → Internet → Firefox I Editor: Aplicaciones → Programación → Editor de textos SciTE Trick: To create a launcher drag and drop the icon onto the Desktop or Panel. Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Panel: places in the file explorer Folders: I Home ($HOME): Lugares → Carpeta Personal I Desktop: Lugares → Escritorio Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Filesystem tree Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home File explorer I Directories (folders) contain files and other directories. I Similar to Windows and Mac OS X. I Copy, paste, cut. . . Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Editing files with SciTE Different ways to open a file I File → Open I Drag and drop the file to an already open SciTE. I Dragging the file to the SciTE icon. Typing in the terminal (recommended): I I scite file-name.p Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Compiling After saving the file. Different ways: I Typing in the terminal: I pick file-name.p I En SciTE: Tools → Compile. I En SciTE: click in the hammer button in the Tool bar. Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Basic commands I man: asking the system for help about something. I I man cp apropos: find about something in the man pages. I apropos copy Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Basic commands I pwd: print the working directory (the one currently being used). I cd: change the working directory. I I cd mydir1 ls: list the contents of a directory I I ls mydir1 ls -l Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Basic commands I mkdir: create directories I I cp: copy files. I I I mkdir midir2 cp fich1 fich2 cp fich1 fich2 midir1 mv: move files. I I mv fich1 fich2 mv fich2 fich3 midir1 Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming I From home rm: delete files (BE CAREFUL!). I I I Command line rm fich1 fich2 rm -r midir1 ←CAREFUL cat: see the contents of files. I I cat fich4 cat fich4 fich5 Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Paths I Absolute path: string of directories starting from the root separated by slashes. Always starts with slash (root). I I Relative path: string of directories starting with the working directory. I I al-09-10/juan/file.txt .. : father directory. I I /home/al-09-10/juan/file.txt ../juan/file.txt . : current directory. I ./file.txt Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Executable files I ./ to tell the system that it is in the current directory. I I I ./myprogram or the absolute path: /home/al-09-10/juan/myprogram You can add the current directory to the places where executables are searched (default configuration in the lab): I export PATH=.:$PATH Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Command line tricks I ↑ to repeat already executed commands. I Tab to complete names I Ctrl+r to search in the already executed commands. Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Copy files Windows: I Install this app: Winscp http://winscp.net/eng/docs/lang:es MacOSX I In Finder: Ir → Conect to server I In the command line: scp Linux I In the file explorer: Lugares → Conectar con servidor → (seleccionar SSH) I In the command line: scp Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Remote console Windows: I Install this app: Putty http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html MacOSX I In the command line: ssh Linux I In the command line: ssh Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Example with scp Copy a file from a remote server to the local machine (for example, from the lab to my home terminal): scp your-login@servidor:origin-filename destitnation-filename Examples: scp [email protected]:expr.p expr.p (copies the file expr.p from juan’s home directory to the working directory in juan’s PC) scp [email protected]:Desktop/a.txt a.txt (copy the file a.txt from juan’s Desktop directory in the server to the local directory in his PC) Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC Desktop Picky programming Command line From home Example with scp Copy a file from the local machine to a remote server (for example, from my home terminal to the lab): scp origin-filename your-login@servidor:destination-filename Example: scp a.txt [email protected]:Desktop/a.txt (copy the file a.txt from the local directory in his PC to juan’s Desktop directory in the server) Linux Labs: mini survival guide Laboratorio de Sistemas, Grupo de Sistemas y Comunicaciones, URJC