linux

How to clear files contents in Linux

  1. Logon on to your server – ssh root@192.168.100.100
  2. Navigate to the folder. cd /content/logs
  3. Type du -sh to view storage in GB for the folder.
  4. To clear the contents for file name : log-we.log
    • echo “” > log-we.log

Yarn Installation

When installing yarn in ubuntu use the command below.

Remember not to use apt install yarn

sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn -y

Search for large files

In Linux sometimes you need to locate the largest file in your system. To do so, you need to select the mount location when searching.

sudo du -aBm / 2>/dev/null | sort -nr | head -n 10