Copiar readme.txt a el directorio documents
$ cp readme.txt documents/$ cp readme.txt readme.bak.txtAvanzado:
$ cp readme{,.bak}.txt$ cp -a myMusic myMedia/
# or
$ cp -a myMusic/ myMedia/myMusic/$ cp -a myMusic/ myMedia/$ mv readme.txt documents/Siempre usar una barra final / cuando se mueven archivos
$ mv readme.txt README.md$ mv myMedia myMusic/
# or
$ mv myMedia/ myMusic/myMedia$ mv myMedia/ myMusic/$ rsync -a /images/ /images2/ # note: may over-write files with the same name, so be careful!$ touch 'new file' # updates the file's access and modification timestamp if it already exists
# or
$ > 'new file' # note: erases the content if it already exists$ mkdir 'untitled folder'
# or
$ mkdir -p 'path/may/not/exist/untitled\ folder'$ du -sh node_modules/$ stat readme.md # on Linux$ xdg-open file # on Linux
$ open file # on MacOS$ zip -r archive_name.zip folder_to_compress$ unzip archive_name.zip$ zipinfo archive_name.zip
# or
$ unzip -l archive_name.zip$ rm my_useless_file$ rm -r my_useless_folder$ ls my_folder # Simple
$ ls -la my_folder # -l: show in list format. -a: show all files, including hidden. -la combines those options.
$ ls -alrth my_folder # -r: reverse output. -t: sort by time (modified). -h: output human-readable sizes.$ tree # en Linux
$ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' # en MacOS o Linux
# Nota: se bebe instalar homebrew (https://brew.sh) para usar tree.
# brew install treePor nombre
$ find . -iname "name"Buscar un archivo modificado hace mas de 5 dias
$ find . -mtime +5$ calMostrar un mes y año determinado
$ cal 11 2018$ bc$ killall program_namecurl -i google.comcurl ifconf.meip a$ cat readme.txt
# Si el archivo es muy grande se puede usar less para ver paginado.
$ less readme.txt$ grep -i "Query" file.txt$ df -h$ top$ ps -fax$ tail /var/log/auth.log$ tail -n 50 /var/log/auth.log #ver 50 lineas$ tail -f /var/log/auth.log #ver ultimas lineas en tiempo real$ !! #corre el ultimo comando$ sudo !! #corre el ultimo comando como sudo$ !<word> #corre el ultimo comando que incluya esa palabra$ !<word>:p #lista el ultimo comando que incluya esa palabra$ [espacio]<comando> #corre el comando para que no se incluya en el historialCtrl + a Go to the beginning of the line you are currently typing on
Ctrl + e Go to the end of the line you are currently typing on
Ctrl + l Clears the Screen, similar to the clear command
Ctrl + u Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + h Same as backspace
Ctrl + r Lets you search through previously used commands
Ctrl + c Kill whatever you are running
Ctrl + d Exit the current shell
Ctrl + z Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + w Delete the word before the cursor
Ctrl + k Clear the line after the cursor
Ctrl + t Swap the last two characters before the cursor
Esc + t Swap the last two words before the cursor
Alt + F Move cursor forward one word on the current line
Alt + B Move cursor backward one word on the current line
Tab Auto-complete files and directory names