¡Esta es una revisión vieja del documento!
# Mirar el espacio en disco $ df -h # Mirar el espacio en memoria $ free -h # Mirar la ip $ ip address
tar -zcvf archive-name.tar.gz directory-name # Extract tar -zxvf prog-1-jan-2005.tar.gz # Extract in a particular directory tar -zxvf prog-1-jan-2005.tar.gz -C /tmp
alias emacs="emacs -nw"
Instalar: apt install <package>
Listar paquetes: apt list –<param> <?package>, param=(installed|upgradeable|all-versions)
Mirar distantas versiones de un paquete: apt-cache policiy <package>
Instalar un paquete en una versión concreta: apt install <package>=<version>
You just need to do apt-get install –only-upgrade <packagename>. This will upgrade only that single package, and only if it is installed. If you wish to install the package if it doesn't exist, or upgrade it if it does, you may leave out –only-upgrade.
Edit apt-conf file (or create a new one if you have no one yet) using the editor of your choice.
sudo nano /etc/apt/apt.conf
Add this line to your /etc/apt/apt.conf file (substitute your details for yourproxyaddress and proxyport).
Acquire::http::Proxy "http://yourproxyaddress:proxyport";
ls -tls -trDisk usage.
df -mdf -hChange the owner:
chown www-data: -R . To see the last lines of a file.
-f parameter.zip -r app.old.zip app/
!<command> will execute the <command> with the parameters you executed last time: remember the command name e.g. !ls will execute your last “ls -lrt” , !vim will open your last file without typing full command.
!! will execute the last command.
cd - goes to the prev visited path.
pushd and popd create a stack of path. If you arrive to a path and want to add it on the stack, you will do pushd .
With dirs command you can see the stack.
You can add this to .bashsrc to add cd + as ot do popd. So when you visit a path you auto add pushd's:
cd()
{
if [ $# -eq 0 ]; then
pushd "$HOME" > /dev/null
elif [ $1 = "+" ]; then
popd > /dev/null
else
pushd "$@" > /dev/null
fi
}
You can do Ctrl+l to clear the screen which is the same than clear command.
To actually reset the scroll and everything you will use the reset command.
My favorite new one that I have been using a lot:
function cheat() {
curl cht.sh/$1
}
It queries the cht.sh cheatsheet of various Unix commands. 'cheat tar' prints:
# To extract an uncompressed archive:
tar -xvf /path/to/foo.tar
# To create an uncompressed archive:
tar -cvf /path/to/foo.tar /path/to/foo/
# To extract a .gz archive:
tar -xzvf /path/to/foo.tgz
# To create a .gz archive:
tar -czvf /path/to/foo.tgz /path/to/foo/
...