Compress Files
tar -xzf example.tgz # uncompress
tar --exclude='.DS_Store' --exclude='._*' -czf your-file.tgz folder/ # compress
tar -xzf example.tgz # uncompress
tar --exclude='.DS_Store' --exclude='._*' -czf your-file.tgz folder/ # compress
Option 1: Resign
codesign --deep --force --sign "Developer ID Application: Your Name (Team ID)" /path/to/YourApp.app
Option 2: Use a temprary sign
codesign --deep --force --sign - /path/to/YourApp.app
Add following aliases in your ~/.bash_profile
alias ..='cd ..'
alias ...='cd ../../'
alias b='brew'
alias c='clear'
alias l='ls -lah'
alias su='sudo -i'
alias root='sudo -i'
Install jq via following link to parse the string.
curl 'https://api.github.com/repos/jqlang/jq/commits?per_page=5' | jq '.[0]'
To find the largest folders on a file system pass the -a option. This will change the behavior of du to write size counts for files as well as folders. Run the following as root to see the ten largest files or folders on a system. This can be useful if you are dealing with out-of-disk space issues on a system.
du -a / | sort -n -r | head -n 10
5351116 /
2462616 /usr
2153492 /home
2153472 /home/george
1571924 /usr/lib
To sort by file size pass the output of du to sort and use the -n (numeric) and -r (reverse) options.
du ~/go | sort -n -r | less
170440 /home/george/go
132816 /home/george/go/src
74024 /home/george/go/src/github.com
57072 /home/george/go/src/golang.org
sudo firewall-cmd --zone=public --list-ports
sudo firewall-cmd --zone=public --permanent --add-port 8080/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --permanent --remove-port 8080/tcp
$ systemctl disable httpd
rm '/etc/systemd/system/multi-user.target.wants/httpd.service'
$ systemctl status httpd
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service;
disabled
)
$ systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
$ systemctl status httpd
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service;
enabled
)
swapon -s
free -m
total used free shared buffers cached
Mem: 3953 315 3637 8 11 107
-/+ buffers/cache: 196 3756
Swap: 0 0 4095
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 59G 1.5G 55G 3% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 8.3M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
sudo dd if=/dev/zero of=/swapfile count=10240 bs=1MiB
ls -lh /swapfile
-rw-r--r-- 1 root root 4.0G Oct 30 11:00 /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
-rw------- 1 root root 4.0G Oct 30 11:00 /swapfile
sudo mkswap /swapfile
Setting up swapspace version 1, size = 4194300 KiB
no label, UUID=b99230bb-21af-47bc-8c37-de41129c39bf
sudo swapon /swapfile
swapon -s
Filename Type Size Used Priority
/swapfile file 4194300 0 -1
free -m
total used free shared buffers cached
Mem: 3953 315 3637 8 11 107
-/+ buffers/cache: 196 3756
Swap: 4095 0 4095
Edit the file with sudo privileges in your text editor:
sudo nano /etc/fstab
At the bottom of the file, you need to add a line that will tell the operating system to automatically use the swap file that you created:
/swapfile swap swap sw 0 0
First create a new CentOS user account from the command line. For example, create the marlena user account, run:
adduser marlena
Set the password for marlena user by typing the following passwd command:
passwd marlena
A new user account was created. Verify it:
id marlena
In CentOS 8 Linux server all members of the wheel group have sudo access. So all you have to do is append user account to the wheel group using the usermod command command:
usermod -aG wheel marlena
User account marlena now have sudo privileges. Verify it by running the id command or grep command on /etc/passwd and /etc/group files:
id marlena
grep '^marlena' /etc/passwd
grep '^wheel' /etc/group
Below is to give sudo access to an existing user named vivek by adding the user to the wheel group:
usermod -aG wheel vivek
id vivek
userdel -r {userName}
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vim /etc/apt/sources.list
Remove sources.list content using below instead.
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
sudo apt-get update
sudo apt-get -f install
sudo apt-get -y upgrade
sudo apt-get install aptitude
W: Unable to read /etc/apt/preferences.d/ - DirectoryExists (2: No such file or directory)
To fix
mkdir /etc/apt/preferences.d
E: The method driver /usr/lib/apt/methods/https could not be found.
To fix
sudo wget http://archive.ubuntu.com/ubuntu/pool/universe/a/apt/apt-transport-https_1.6.1_all.debb
sudo dpkg -i apt-transport-https_1.6.1_all.deb