Linux command line intefaces LCI Basics

Posted on Actualizado enn

  • clear
  • cd
    • cd .. [back]
    • cd /var/etc
    • cd ~
  • ls
    • listing off the current folder
    • ls /home/
    • ls -l [details, owners]
    • ls -la [hidden files]
  • pwd
    • working directory
  • cp
    • copy
    • cp -v file.smth /var/ [machine tells you what is copying]
  • mv
    • move is how you move or rename folders of files
    • ie. mv somefile.txt newname.txt
    • ie2. mv some.txt /home/ and then ls /home/
  • cat
    • readonly, you can quickly see what is located into that file, cat test.txt
  • less
    • similar to cat, you can see the content in a file
  • grep
    • cat sources.list | grep src
    • So it will only print lines that hava “src” from sources.list (case-sensitive or ignore that with -i)
    • Grep to pull things out of a file. Filtering through text files
  • echo
    • ie. echo “I am alive” > test
    • cat test
    • It will create a file with that text
  • touch
    • ie. touch file1 file2 /home/file3
    • easy way to create empty files
  • mkdir
    • make directory, mkdir newfolder
  • chown
    • ie chown username:usergroup filebla change the ownership of file filebla to user username, who is from the user group root, type ls -la to verify
  • chmod
    • Allows you you to change file permissions
    • ie. echo “echo hello” > test
    • mv test test.sh
    • ls -la even if it is a sh batch script it does not have permissions (x executable)
    • chmod +x [w/r] test.sh
    • and then you can run it ./test.sh will get hello
  • rm
    • remove, it is next to impossible to recover pretty much anything; remove -r directory
  • nano
    • text editor [ctrl+0 save, ctrl+x exit]
  • man + help
    • cp –help
    • man grep
Anuncios

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s