Linux: Useful commands

Copy multiple directories from within another directory
cp -a /path/from /path/to

Make script file (.sh) executable
chmod +x filename.sh

Copy a directory to a new directory:
cp directory1 /opt/directory2 -R

NB The “-R” is required when copying a directory rather that just a file.

List only NFS mounts:
mount -l -t nfs

Is my Linux x86 or x64
Type “arch”. If it returns “i686” or “i386” then it’s 32-bit, if it returns “x86_64” it is 64-bit

Unzip tar
tar -xvzf file_name.tar.gz

Check if a server (Windows included) is listing an NFS share for export
showmount -e

Check version of Debian server
cat /etc/debian_version

debian_get_version

Check codename of Debian server i.e. Wheezy, Jessie etc
lsb_release -a

debian_get_codename

see here for more details of codename release details.

Disclaimer: provided “AS IS” with no warranties and confer no rights

Advertisements