How to change to the previous working directory on the command line on Linux

Type in the command below to go to your previous working directory cd - or cd $OLDPWD Points to remember The "-" is short for previous working directory. The previous working directory is defined by the shell variable $OLDPWD. Everytime you use the cd command it sets the $OLDPWD environment variable. Thus cd $OLDPWD is the same as cd -

April 7, 2018 · 1 min · 60 words · icarnaghan

How to change your Computer Name in Ubuntu

Open a new Terminal Window Type in the following command sudo gedit /etc/hostname The command above will open gedit, change your computer name and close gedit Logout and Login with your credentials and your computer name will be changed

April 7, 2018 · 1 min · 39 words · icarnaghan

How to change your MAC Address in Linux

NOTE: In this example we will change the MAC address for the eth0 interface Open your Command Line Interface Now we are going to shutdown the eth0 Interface using the command below ifconfig eth0 down Now we change the Hardware Address for the eth0 interface ifconfig eth0 hw ether 00:1d:72:dd:00:6f Now we activate the eth0 interface again ifconfig eth0 up

April 7, 2018 · 1 min · 60 words · icarnaghan

How to change your password via Command Line in Linux

Type in the following command: passwd and hit enter! Now you will need to enter your current password. Changing password for YOURNAME. (current) UNIX password: Type in your password and hit **enter ** Now enter your new password: Enter new UNIX password: Retype your new password: Retype new UNIX password: That’s all! Now you should be able to use your new password

April 7, 2018 · 1 min · 62 words · icarnaghan

How to check how long your Linux system has been up and running

In the Command Line Interface type in the uptime command and hit enter uptime Now the uptime information should display eg. The time, how long the system has been running, the amount of users logged in and the load average 22:59:30 up 1:36, 2 users, load average: 0.13, 0.09, 0.08

April 7, 2018 · 1 min · 50 words · icarnaghan

How to check how much memory you have available on Ubuntu (Linux)

Open a Terminal Window if not yet in command line Type in the following command: cat /proc/meminfo This will display a resultset as below of how much memory you have left MemTotal: 1974152 kB MemFree: 373196 kB Buffers: 107380 kB Cached: 881568 kB SwapCached: 13288 kB Active: 872248 kB Inactive: 640876 kB Active(anon): 599548 kB Inactive(anon): 25012 kB Active(file): 272700 kB Inactive(file): 615864 kB Unevictable: 8 kB Mlocked: 8 kB HighTotal: 1103016 kB HighFree: 1612 kB LowTotal: 871136 kB LowFree: 371584 kB SwapTotal: 2493588 kB SwapFree: 2461148 kB Dirty: 72 kB Writeback: 0 kB AnonPages: 514288 kB Mapped: 122972 kB Slab: 50072 kB SReclaimable: 32964 kB SUnreclaim: 17108 kB PageTables: 5136 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 3480664 kB Committed_AS: 2313760 kB VmallocTotal: 122880 kB VmallocUsed: 23780 kB VmallocChunk: 93580 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 4096 kB DirectMap4k: 16376 kB DirectMap4M: 888832 kB ...

April 7, 2018 · 1 min · 153 words · icarnaghan

How to check how much RAM (memory) you have on your PC on Linux

In the command line type the following command and hit enter: {codecitation style=“brush: bash;"}free -m{/codecitation} m = Displays the amount of RAM in Megabytes

April 7, 2018 · 1 min · 24 words · icarnaghan

How to check if a Bash variable is empty

if [ -z "$VARIABLE" ] If $VARIABLE is not set or empty the if statement above will return true, the -z option tests for a zero-length string, so whether $VARIABLE is not set or empty the _if_statement will return true

April 7, 2018 · 1 min · 40 words · icarnaghan

How to check if your Linux System is 32-Bit or 64-Bit

Use the uname -m command within the Terminal. uname -m The above command displays the Machine Hardware Name and indicates whether your system is 32-Bit or 64-Bit. If your system is 64-Bit then the output will be x86_64 and for 32-Bit the output will be either i686 or i386

April 7, 2018 · 1 min · 49 words · icarnaghan

How to check the encoding for a database in PostgreSQL

To do this login to the command line and switch to the main Postgres user. eg su postgres The type the psql -l command this will produce a list of databases with there encodings List of databases Name | Owner | Encoding ------------------------+------------+----------- DB1 | postgres | UTF8 DB2 | postgres | UTF8 DB3 | postgres | UTF8 DB4 | clicks | SQL_ASCII DB5 | clicks | SQL_ASCII

April 7, 2018 · 1 min · 68 words · icarnaghan