kerrtravers
4 months ago

Handy macOS terminal commands 🛠️

Stop iTunes from responding to the keyboard media keys

launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null

Disable the "Are you sure you want to open this application?" dialog

defaults write com.apple.LaunchServices LSQuarantine -bool false

Tell macOS to always show all files in finder

defaults write com.apple.finder AppleShowAllFiles YES
limitlis
4 months ago

Easy to remember local static web server - httpster

I know there's tons of options out there, but this one is my go-to. Primarily because it's hard to forget, but also has just the right amount of features.

httpster

Install:

npm i -g httpster

Then from any folder you want served, simply:

httpster

Default port is 3333.

Advanced Usage:

With custom port: httpster -p 8080

Declare directory as root: httpster -d /dist

Even more advanced usage, https://github.com/SimbCo/httpster

avgenakisg
4 months ago

Check your battery status and date in your mac

While I create www.loopcv.pro It happens a lot to travel and work from coffee shops. Two commands that I use as aliases are:

1) alias now='cal; date +"%T"; date +"%d-%m-%Y"' which prints the calendar, the date and the time

2) alias bat='pmset -g batt' which prints the battery status and the remaining time!

🚀🚀

Booligoosh
4 months ago

A command to give your terminal windows a title

Put this in your bash profile: function title() { echo -e "\033]0;${1:?please specify a title}\007" ; }

Then just type title "myTitle" in the terminal.

Booligoosh
4 months ago

Hide desktop items on Mac

This terminal command will hide everything on your desktop, so it doesn't give you anxiety 😅

It doesn't actually delete the stuff on your desktop, it just hides it. You can still access the items by going to your Desktop folder in Finder.

defaults write com.apple.finder CreateDesktop -bool false;killall Finder

And to show them again, you can do this: defaults write com.apple.finder CreateDesktop -bool true;killall Finder

FabioRosado
5 months ago

Copy the ssh key id_rsa.pub directly from the terminal

You don't need to copy and paste the key to the machine you want to connect to another. All you have to do is generate your key and then type this command on the terminal:

ssh-copy-id <username>@<ipaddress/host>

You will be prompt to type in the username password and then the key will be copied, you can now log into the machine by using the command ssh <username>@<ipaddress/host>

FabioRosado
5 months ago

Get last typed command on terminal

You can run the last typed command in the terminal by using !!.

Let's say that your history looks like this:

cd
ls
cd Documents
ls

if you type !! the last command (ls) will be auto-filled in the terminal for you.

But you can also get more specific, by using !<term> so you could use !cd to get the last cd command which was cd Documents

FabioRosado
5 months ago

Search previous typed command on terminal

If you press ctrl+r in the terminal you will activate the reverse-i-search. With it, you can search your whole history for a command. If you type very long commands you or if you don't remember the whole command that you typed you can just press ctrl+r and type the bit you remember, the command that matches will show up.

If you want to search it again all you need to do is press ctrl+r again.

Example

Let's say you used the command git rebase -i Head~2 before, but you don't remember what does after git rebase or you just don't feel like typing the whole thing.

Press ctrl+r and then type git re if git rebase -i Head~2 was the last command that you used, it will be shown. Then just press enter to run the command.

FabioRosado
5 months ago

Vim: Search for a term

When editing a long file with vim, you might need to try and find a certain word or term, but scrolling down is not really practical.

Luckily, Vim has your back and you can just use these two commands to search for a term through the whole file.

  • :?<term>
    • searches for that term from the cursor down
  • :\<term>
    • searches for that term from the cursor up

If you want to cycle through different occurrences of the same term you can use: - n or / - go to the next searched term - N or ? - go to the previous searched term

mddanishyusuf
5 months ago

Next.js Application Deploy on Zeit

I'm using Zeit service to host my Next.js Application because it's easy to maintain and deploy.

  1. First, just run this command(now-cli is required for this) now

  2. When now command done you will get the deployment URL. that URL changed every time when you make a new deploy. So, this way your production application will not affect. that mean alias is not assigned to the latest deployment URL. Cool!!!

  3. So, if you seem that latest deployment is good to go on production then you just have to assign the alias to this deployment URL. now alias <deployment URL> <domain> like this: now alias dailyhack-3c1tmk4cu.now.sh dailyhack.xyz

that's all.

Load More